Merge pull request #488 from epage/debug

feat(cli): Log the policy
This commit is contained in:
Ed Page 2022-05-16 09:32:56 -05:00 committed by GitHub
commit 4ea85c1b69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View file

@ -47,7 +47,7 @@ impl Entry {
}
}
fn imply(variants: &mut Vec<Variant>, required: Category, missing: Category) {
fn imply(variants: &mut [Variant], required: Category, missing: Category) {
let missing_exists = variants
.iter()
.any(|v| v.types.iter().any(|t| t.category == missing));

View file

@ -171,6 +171,7 @@ impl typos::Dictionary for BuiltIn {
}
}
#[allow(clippy::ptr_arg)]
fn case_correct(correction: &mut Cow<'_, str>, case: Case) {
match case {
Case::Lower | Case::None => (),

View file

@ -313,8 +313,18 @@ impl DirConfig {
.and_then(|g| g.file_type_def())
.map(|f| f.name());
name.and_then(|name| self.types.get(name).copied())
.unwrap_or(self.default)
name.and_then(|name| {
log::debug!("{}: `{}` policy", path.display(), name);
self.types.get(name).copied()
})
.unwrap_or_else(|| {
log::debug!(
"{}: default policy for `{}` file type",
path.display(),
name.unwrap_or("<unknown>")
);
self.default
})
}
}