Skip to content

Commit

Permalink
Merge pull request #486 from sylvestre/uucore
Browse files Browse the repository at this point in the history
Update to uucore 0.0.29
  • Loading branch information
hanbings authored Jan 20, 2025
2 parents c45e474 + a21c379 commit 78e5201
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 43 deletions.
55 changes: 22 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ walkdir = "2.5"
regex = "1.11"
once_cell = "1.20"
onig = { version = "6.4", default-features = false }
uucore = { version = "0.0.27", features = ["entries", "fs", "fsext", "mode"] }
uucore = { version = "0.0.29", features = ["entries", "fs", "fsext", "mode"] }
nix = { version = "0.29", features = ["fs", "user"] }

[dev-dependencies]
Expand Down
12 changes: 3 additions & 9 deletions src/find/matchers/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use super::{Matcher, MatcherIO, WalkEntry};
use uucore::error::UResult;

/// The latest mapping from dev_id to fs_type, used for saving mount info reads
#[cfg(unix)]
Expand All @@ -26,15 +27,11 @@ pub struct Cache {
#[cfg(unix)]
use std::{
cell::RefCell,
error::Error,
io::{stderr, Write},
path::Path,
};
#[cfg(unix)]
pub fn get_file_system_type(
path: &Path,
cache: &RefCell<Option<Cache>>,
) -> Result<String, Box<dyn Error>> {
pub fn get_file_system_type(path: &Path, cache: &RefCell<Option<Cache>>) -> UResult<String> {
use std::os::unix::fs::MetadataExt;

// use symlink_metadata (lstat under the hood) instead of metadata (stat) to make sure that it
Expand All @@ -51,10 +48,7 @@ pub fn get_file_system_type(
}
}

let fs_list = match uucore::fsext::read_fs_list() {
Ok(fs_list) => fs_list,
Err(err) => Err(err)?,
};
let fs_list = uucore::fsext::read_fs_list()?;
let result = fs_list
.into_iter()
.find(|fs| fs.dev_id == dev_id)
Expand Down

0 comments on commit 78e5201

Please sign in to comment.