Browse Source

chore: fix a few Clippy warnings

ariasuni 3 weeks ago
parent
commit
e038643d2e
3 changed files with 4 additions and 6 deletions
  1. 2 4
      src/fs/feature/xattr.rs
  2. 1 1
      src/options/file_name.rs
  3. 1 1
      src/options/view.rs

+ 2 - 4
src/fs/feature/xattr.rs

@@ -433,8 +433,7 @@ mod extended_attrs {
     // Get a vector of all attribute names and values on `path`
     #[cfg(any(target_os = "macos", target_os = "linux"))]
     pub fn attributes(path: &Path, follow_symlinks: bool) -> io::Result<Vec<Attribute>> {
-        let path = CString::new(path.as_os_str().as_bytes())
-            .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
+        let path = CString::new(path.as_os_str().as_bytes()).map_err(io::Error::other)?;
         let attr_names = list_attributes(&path, follow_symlinks, os::list_xattr)?;
 
         #[cfg(target_os = "linux")]
@@ -447,8 +446,7 @@ mod extended_attrs {
         let mut attrs = Vec::with_capacity(attr_names.len());
         for attr_name in attr_names {
             if let Some(name) = attr_name.to_str() {
-                let attr_name =
-                    CString::new(name).map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
+                let attr_name = CString::new(name).map_err(io::Error::other)?;
                 let value = get_attribute(&path, &attr_name, follow_symlinks, os::get_xattr)?;
                 attrs.push(Attribute {
                     name: name.to_string(),

+ 1 - 1
src/options/file_name.rs

@@ -74,7 +74,7 @@ impl ShowIcons {
                         vars.source(vars::EXA_ICON_SPACING, vars::EZA_ICON_SPACING)
                             .unwrap_or("1"),
                     );
-                    Err(OptionsError::FailedParse(columns.to_string(), source, e))
+                    Err(OptionsError::FailedParse(columns.clone(), source, e))
                 }
             }
         } else {

+ 1 - 1
src/options/view.rs

@@ -77,7 +77,7 @@ impl Mode {
                 return Ok(Self::Grid(grid));
             }
             return Ok(Self::Lines);
-        };
+        }
 
         if long {
             let details = details::Options::deduce_long(matches, vars, strict)?;