minor fixes

This commit is contained in:
Oleh Stolyar 2023-03-08 19:32:09 +00:00
parent 63f8fdfe3d
commit 609e686d7a
2 changed files with 6 additions and 6 deletions

View File

@ -80,9 +80,9 @@ pub fn from_path(file_path: &Path) -> Result<Root> {
.and_then(|content| from_string(&content))
}
/// Parses the provide string into a treefmt config object
/// Parses the provided string into a treefmt config object
pub fn from_string(file_contents: &str) -> Result<Root> {
toml::from_str::<Root>(&file_contents).map_err(Error::msg)
toml::from_str::<Root>(file_contents).map_err(Error::msg)
}
#[cfg(test)]

View File

@ -57,7 +57,7 @@ pub fn run_treefmt(
// Make sure all the given paths are absolute. Ignore the ones that point outside of the project root.
let paths = paths.iter().fold(vec![], |mut sum, path| {
let abs_path = expand_path(path, work_dir);
if abs_path.starts_with(&tree_root) {
if abs_path.starts_with(tree_root) {
sum.push(abs_path);
} else {
warn!(
@ -337,7 +337,7 @@ fn print_summary(
) {
println!(
r#"
{} files changed in {:.0?} (found {}, matched {}, cache misses {})
{} files changed in {:.0?} (found {}, matched {}, cache misses {})
"#,
reformatted_files,
start_time.elapsed(),
@ -363,7 +363,7 @@ pub fn run_treefmt_stdin(
assert!(path.is_absolute());
// Make sure all the given paths are absolute. Ignore the ones that point outside of the project root.
if !path.starts_with(&tree_root) {
if !path.starts_with(tree_root) {
return Err(anyhow!(
"Ignoring path {}, it is not in the project root",
path.display()
@ -401,7 +401,7 @@ pub fn run_treefmt_stdin(
);
// Collect all formatters that match the path
let formatters: Vec<&Formatter> = formatters.values().filter(|f| f.is_match(&path)).collect();
let formatters: Vec<&Formatter> = formatters.values().filter(|f| f.is_match(path)).collect();
if formatters.is_empty() {
warn!("no formatter found for path {:?}", path);