From a17f6a284affb556410a46a35d5ba7ef41d8d275 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 16 May 2022 09:06:22 -0500 Subject: [PATCH 1/2] feat(cli): Log the policy This is in part to help in cases like #487 but it will also help people generally configure and debug their config. --- src/policy.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/policy.rs b/src/policy.rs index cda4010..9fe71ad 100644 --- a/src/policy.rs +++ b/src/policy.rs @@ -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("") + ); + self.default + }) } } From 5ae7bda8eb631aa0bd362603a8ae567270c8b3f1 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 16 May 2022 09:09:17 -0500 Subject: [PATCH 2/2] style: Silence clippy --- crates/varcon-core/src/lib.rs | 2 +- src/dict.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/varcon-core/src/lib.rs b/crates/varcon-core/src/lib.rs index c785175..b680515 100644 --- a/crates/varcon-core/src/lib.rs +++ b/crates/varcon-core/src/lib.rs @@ -47,7 +47,7 @@ impl Entry { } } -fn imply(variants: &mut Vec, 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)); diff --git a/src/dict.rs b/src/dict.rs index 26f527c..f3a28f9 100644 --- a/src/dict.rs +++ b/src/dict.rs @@ -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 => (),