message: Use native rust way replace if-self
diff: @@ -189,7 +189,7 @@ impl DirectSuperBlockV6 {
  offset,
  blocks_count,
  parent_inode: Cell::new(None),
  - name: Cell::new(None),
  + name: RefCell::new(None),
  })
  }
  @@ -206,7 +206,7 @@ impl DirectSuperBlockV6 {
  // # Safety
  // inode always valid
  inode.parent_inode = Cell::new(Some(parent_inode));
  - inode.name = Cell::new(Some(name));
  + inode.name = RefCell::new(Some(name));
  inode
  })
  }
  @@ -397,7 +397,7 @@ pub struct OndiskInodeWrapper {
  // this time parent_inode field is None, the other Inodes are created through OndiskInodeWrapper,
  // this field will be filled with inode_wrapper_with_parent
  parent_inode: Cell<Option<Inode>>,
  - name: Cell<Option<OsString>>,
  + name: RefCell<Option<OsString>>,
  }
  impl OndiskInodeWrapper {
  @@ -1069,10 +1069,9 @@ impl RafsInode for OndiskInodeWrapper {
  /// # Safety
  /// It depends on Self::validate() to ensure valid memory layout.
  fn name(&self) -> OsString {
  - if let Some(name) = self.name.take() {
  - self.name.set(Some(name.clone()));
  - name
  - } else {
  + match self.name.borrow().as_ref() {
  + Some(name) => name.clone(),
  + None => {
  debug_assert!(self.is_dir());
  let cur_ino = self.ino();
  if cur_ino == self.mapping.root_ino() {
  @@ -1093,10 +1092,11 @@ impl RafsInode for OndiskInodeWrapper {
  },
  )
  .unwrap();
  - self.name.set(Some(curr_name.clone()));
  + *self.name.borrow_mut() = Some(curr_name.clone());
  curr_name
  }
  }
  + }
  // RafsV5 flags, not used by v6, return 0
  fn flags(&self) -> u64 {
  0
  @@ -1128,15 +1128,16 @@ impl RafsInode for OndiskInodeWrapper {
  /// Get inode number of the parent directory.
  fn parent(&self) -> u64 {
  - if let Some(parent) = self.parent_inode.get() {
  - parent
  - } else {
  + match self.parent_inode.get() {
  + Some(parent) => parent,
  + None => {
  debug_assert!(self.is_dir());
  let ino = self.get_child_by_name(OsStr::new("..")).unwrap().ino();
  self.parent_inode.set(Some(ino));
  ino
  }
  }
  + }
  /// Get real device number of the inode.
  fn rdev(&self) -> u32 {
  