From 27ab2813921c088ca4615fd66fc6cd90f6f1c033 Mon Sep 17 00:00:00 2001 From: Alessio Placitelli Date: Tue, 21 Jul 2020 10:17:12 +0200 Subject: [PATCH] Rename F to V and make clippy happy --- glean-core/src/debug.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/glean-core/src/debug.rs b/glean-core/src/debug.rs index 7501b67d66..8f3d202759 100644 --- a/glean-core/src/debug.rs +++ b/glean-core/src/debug.rs @@ -70,7 +70,7 @@ impl DebugOptions { /// A representation of a debug option, /// where the value can be set programmatically or come from an environment variable. #[derive(Debug)] -pub struct DebugOption Option, F = fn(&T) -> bool> { +pub struct DebugOption Option, V = fn(&T) -> bool> { /// The name of the environment variable related to this debug option. env: String, /// The actual value of this option. @@ -80,18 +80,18 @@ pub struct DebugOption Option, F = fn(&T) -> bool> { extraction: E, /// Optional function to validate the value parsed from the environment /// or passed to the `set` function. - validation: Option, + validation: Option, } -impl DebugOption +impl DebugOption where T: Clone, E: Fn(String) -> Option, - F: Fn(&T) -> bool, + V: Fn(&T) -> bool, { /// Create a new debug option, /// tries to get the initial value of the option from the environment. - pub fn new(env: &str, extraction: E, validation: Option) -> Self { + pub fn new(env: &str, extraction: E, validation: Option) -> Self { let mut option = Self { env: env.into(), value: None, @@ -177,6 +177,7 @@ fn tokenize_string(value: String) -> Option> { /// /// The regex crate isn't used here because it adds to the binary size, /// and the Glean SDK doesn't use regular expressions anywhere else. +#[allow(clippy::ptr_arg)] fn validate_tag(value: &String) -> bool { if value.is_empty() { log::error!("A tag must have at least one character."); @@ -210,6 +211,7 @@ fn validate_tag(value: &String) -> bool { /// /// This builds upon the existing `validate_tag` function, since all the /// tags should respect the same rules to make the pipeline happy. +#[allow(clippy::ptr_arg)] fn validate_source_tags(tags: &Vec) -> bool { if tags.is_empty() { return false; @@ -246,6 +248,7 @@ mod test { #[test] fn debug_option_is_correctly_validated_when_necessary() { + #[allow(clippy::ptr_arg)] fn validate(value: &String) -> bool { value == "test" }