From 311b2a40213aa48131a189f99dc4258d354c0c78 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Fri, 24 Dec 2021 04:58:51 -0600 Subject: Fix old warnings --- examples/ext2.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'examples') diff --git a/examples/ext2.rs b/examples/ext2.rs index 996d1fd..c1f4bce 100644 --- a/examples/ext2.rs +++ b/examples/ext2.rs @@ -322,7 +322,7 @@ impl Fuse for Ext2 { "(empty)".into() } }) - .unwrap_or("(bad)".into()); + .unwrap_or_else(|| "(bad)".into()); log::info!("UUID: {}", Uuid::from_bytes(self.superblock.s_uuid)); log::info!("Label: {}", label.escape_debug()); @@ -476,10 +476,6 @@ impl blown_fuse::fs::Inode for Inode { } } -fn early_error>(_: ()) -> Result { - Err(Errno::EINVAL.into()) -} - fn main() -> Result<(), Box> { let matches = App::new("ext2") .about("read-only ext2 FUSE driver") @@ -535,16 +531,21 @@ fn main() -> Result<(), Box> { let superblock = superblock.and_then(|superblock| try_from_bytes(superblock).ok()); let superblock: &'static Superblock = match superblock { Some(superblock) => superblock, - None => return early_error(log::error!("Bad superblock")), + None => { + log::error!("Bad superblock"); + return Err(Errno::EINVAL.into()); + } }; if superblock.s_magic != 0xef53 { - return early_error(log::error!("Bad magic")); + log::error!("Bad magic"); + return Err(Errno::EINVAL.into()); } let (major, minor) = (superblock.s_rev_level, superblock.s_minor_rev_level); if (major, minor) != (1, 0) { - return early_error(log::error!("Unsupported revision: {}.{}", major, minor)); + log::error!("Unsupported revision: {}.{}", major, minor); + return Err(Errno::EINVAL.into()); } let fs = Ext2 { -- cgit v1.2.3