diff --git a/src/allocator.rs b/src/allocator.rs index 862d9fada285993b195c5e6a15db47a5b0944109..dbe23efe8075db63ca4edcb7b8f1c5184d97fe42 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -147,10 +147,7 @@ impl AllocEntry { impl Clone for AllocEntry { fn clone(&self) -> Self { - Self { - addr: self.addr, - count: self.count, - } + *self } } diff --git a/src/bin/mkfs.rs b/src/bin/mkfs.rs index 9ac2dfe5a74d57b50109eb955002fdce8f0b1307..b8689409a2bbc6513119291a4bfd7c68a5e188a2 100644 --- a/src/bin/mkfs.rs +++ b/src/bin/mkfs.rs @@ -76,7 +76,7 @@ fn main() { let password = io::stdin() .read_passwd(&mut io::stderr()) .unwrap() - .unwrap_or(String::new()); + .unwrap_or_default(); eprintln!(); diff --git a/src/bin/mount.rs b/src/bin/mount.rs index 707607ffaaeb786f7d455ee924b6625368be4316..d157c14ce833db782cf9351d6357b517989b2e18 100644 --- a/src/bin/mount.rs +++ b/src/bin/mount.rs @@ -142,7 +142,7 @@ fn filesystem_by_path( let password = io::stdin() .read_passwd(&mut io::stderr()) .unwrap() - .unwrap_or(String::new()); + .unwrap_or_default(); eprintln!(); @@ -158,10 +158,10 @@ fn filesystem_by_path( bootloader_password() }; - match DiskFile::open(&path).map(|image| DiskCache::new(image)) { + match DiskFile::open(path).map(DiskCache::new) { Ok(disk) => match redoxfs::FileSystem::open( disk, - password_opt.as_ref().map(|x| x.as_slice()), + password_opt.as_deref(), block_opt, true, ) { @@ -277,7 +277,7 @@ fn daemon(disk_id: &DiskId, mountpoint: &str, block_opt: Option<u64>, mut write: }; if let Some((path, filesystem)) = filesystem_opt { - match mount(filesystem, &mountpoint, |mounted_path| { + match mount(filesystem, mountpoint, |mounted_path| { capability_mode(); println!( diff --git a/src/block.rs b/src/block.rs index 266648a2d90baad02615dbaa9f911b1c5e931fe1..70dabb9c7a2d0faad6c84d258d1d9631c65219a2 100644 --- a/src/block.rs +++ b/src/block.rs @@ -139,11 +139,7 @@ impl<T> BlockPtr<T> { impl<T> Clone for BlockPtr<T> { fn clone(&self) -> Self { - Self { - addr: self.addr, - hash: self.hash, - phantom: PhantomData, - } + *self } } diff --git a/src/dir.rs b/src/dir.rs index d6c047b9032b62ba3df33ee919be0ea34f6baf6c..379e3b328e4baa4969a076eabc6eed70b2bb2a4c 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -45,10 +45,7 @@ impl DirEntry { impl Clone for DirEntry { fn clone(&self) -> Self { - Self { - node_ptr: self.node_ptr, - name: self.name, - } + *self } } diff --git a/src/mount/fuse.rs b/src/mount/fuse.rs index 8714e3d13d768b390b8a4fda1a54d5a1c5cca442..ae6e1c00e57ae54c190118ccf0f6cbbfbfbc3179 100644 --- a/src/mount/fuse.rs +++ b/src/mount/fuse.rs @@ -110,7 +110,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.entry(&TTL, &node_attr(&node), 0); } Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); } } } @@ -122,7 +122,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.attr(&TTL, &node_attr(&node)); } Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); } } } @@ -150,7 +150,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { let mut node = match self.fs.tx(|tx| tx.read_tree(node_ptr)) { Ok(ok) => ok, Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); return; } }; @@ -207,7 +207,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { } } Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); return; } } @@ -217,7 +217,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { if node_changed { if let Err(err) = self.fs.tx(|tx| tx.sync_tree(node)) { - reply.error(err.errno as i32); + reply.error(err.errno); return; } } @@ -253,7 +253,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.data(&data[..count]); } Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); } } } @@ -286,7 +286,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.written(count as u32); } Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); } } } @@ -337,7 +337,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { let node = match self.fs.tx(|tx| tx.read_tree(child.node_ptr())) { Ok(ok) => ok, Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); return; } }; @@ -362,7 +362,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.ok(); } Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); } } } @@ -393,7 +393,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.created(&TTL, &node_attr(&node), 0, 0, flags as u32); } Err(error) => { - reply.error(error.errno as i32); + reply.error(error.errno); } } } @@ -423,7 +423,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.entry(&TTL, &node_attr(&node), 0); } Err(error) => { - reply.error(error.errno as i32); + reply.error(error.errno); } } } @@ -438,7 +438,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.ok(); } Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); } } } @@ -453,7 +453,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.ok(); } Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); } } } @@ -499,7 +499,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.entry(&TTL, &node_attr(&node), 0); } Err(error) => { - reply.error(error.errno as i32); + reply.error(error.errno); } } } @@ -521,7 +521,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { reply.data(&data[..count]); } Err(err) => { - reply.error(err.errno as i32); + reply.error(err.errno); } } } @@ -547,7 +547,7 @@ impl<'f, D: Disk> Filesystem for Fuse<'f, D> { .tx(|tx| tx.rename_node(orig_parent_ptr, orig_name, new_parent_ptr, new_name)) { Ok(()) => reply.ok(), - Err(err) => reply.error(err.errno as i32), + Err(err) => reply.error(err.errno), } } } diff --git a/src/tree.rs b/src/tree.rs index 4526d3778152baec25d07757a2cf433baf79d358..7e9468f561f37e54d60d2ca964ae19411898df15 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -135,10 +135,7 @@ impl<T> TreePtr<T> { impl<T> Clone for TreePtr<T> { fn clone(&self) -> Self { - Self { - id: self.id, - phantom: PhantomData, - } + *self } }