diff options
Diffstat (limited to 'cli/fmt.rs')
-rw-r--r-- | cli/fmt.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cli/fmt.rs b/cli/fmt.rs index 452ae20b5..1ebf27900 100644 --- a/cli/fmt.rs +++ b/cli/fmt.rs @@ -32,11 +32,11 @@ const BOM_CHAR: char = '\u{FEFF}'; /// First argument and ignore supports globs, and if it is `None` /// then the current directory is recursively walked. pub async fn format( - args: Vec<String>, + args: Vec<PathBuf>, check: bool, - exclude: Vec<String>, + exclude: Vec<PathBuf>, ) -> Result<(), AnyError> { - if args.len() == 1 && args[0] == "-" { + if args.len() == 1 && args[0].to_string_lossy() == "-" { return format_stdin(check); } // collect all files provided. @@ -232,7 +232,7 @@ fn is_supported(path: &Path) -> bool { } pub fn collect_files( - files: Vec<String>, + files: Vec<PathBuf>, ) -> Result<Vec<PathBuf>, std::io::Error> { let mut target_files: Vec<PathBuf> = vec![]; @@ -242,12 +242,12 @@ pub fn collect_files( is_supported, )); } else { - for arg in files { - let p = PathBuf::from(arg); - if p.is_dir() { - target_files.extend(files_in_subtree(p.canonicalize()?, is_supported)); + for file in files { + if file.is_dir() { + target_files + .extend(files_in_subtree(file.canonicalize()?, is_supported)); } else { - target_files.push(p.canonicalize()?); + target_files.push(file.canonicalize()?); }; } } |