formatter: clean the formatter path

In cases where the formatter path is relative, the "which" crate doesn't
remove the "./" in between.
This commit is contained in:
zimbatm 2021-03-05 10:57:06 +01:00
parent 8de1add053
commit cfa40248bd
No known key found for this signature in database
GPG Key ID: 71BAF6D40C1D63D7

View File

@ -4,6 +4,7 @@ use crate::{expand_if_path, expand_path};
use anyhow::{anyhow, Result};
use globset::{GlobBuilder, GlobSet, GlobSetBuilder};
use log::debug;
use path_clean::PathClean;
use serde::de::{self, Visitor};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::{
@ -125,7 +126,7 @@ impl Formatter {
// Expand the work_dir to an absolute path, using the project root as a reference.
let work_dir = expand_path(&cfg.work_dir, tree_root);
// Resolve the path to the binary
let command = which(&cfg.command)?;
let command = which(&cfg.command)?.clean();
debug!("Found {} at {}", cfg.command.display(), command.display());
assert!(command.is_absolute());