From 89276ba184c51eda380f02b0f486d8ac658271b1 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Sun, 21 Jan 2024 13:59:17 -0600 Subject: [PATCH] clippy --- filmreel/src/error.rs | 4 ++-- filmreel/src/response.rs | 2 +- filmreel/src/utils.rs | 4 ++-- rustfmt.toml | 1 + src/take.rs | 15 +++++---------- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/filmreel/src/error.rs b/filmreel/src/error.rs index b30c8c8..5d4eda7 100644 --- a/filmreel/src/error.rs +++ b/filmreel/src/error.rs @@ -19,7 +19,7 @@ pub enum FrError { Serde(String), Parse(String), File(String, String), - Pest(PestError), + Pest(Box>), } impl Error for FrError { @@ -39,7 +39,7 @@ impl From for FrError { impl From> for FrError { fn from(err: PestError) -> FrError { - Self::Pest(err) + Self::Pest(Box::new(err)) } } diff --git a/filmreel/src/response.rs b/filmreel/src/response.rs index 417d813..562af91 100644 --- a/filmreel/src/response.rs +++ b/filmreel/src/response.rs @@ -238,7 +238,7 @@ impl Validator { // NOTE: Array partial matches need to be ordered as well as contiguous. // The example below would not result in a match: // Other: [A, B, B, C, A, B, B, C] - for i in (0..other_selection.len()) { + for i in 0..other_selection.len() { if i + self_len > other_selection.len() { // other_selection[i..] is already larger than self_selection here // cannot find a partial match at this point diff --git a/filmreel/src/utils.rs b/filmreel/src/utils.rs index 7d7fead..e693de0 100644 --- a/filmreel/src/utils.rs +++ b/filmreel/src/utils.rs @@ -40,8 +40,8 @@ where #[cfg(feature = "full_jql")] pub fn select_value(val: &Value, query: &str) -> Result { - let selectors = query.replace("'", "\""); - match jql::walker(val, Some(&selectors)) { + let selectors = query.replace('\'', "\""); + match jql::walker(val, selectors.as_ref()) { Ok(v) => match v { Value::String(_) => Ok(v), v => Ok(v), diff --git a/rustfmt.toml b/rustfmt.toml index aa1cfd6..a343e24 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -15,4 +15,5 @@ use_small_heuristics = "Default" use_try_shorthand = true trailing_comma = "Vertical" struct_field_align_threshold = 20 +enum_discrim_align_threshold = 20 unstable_features = true diff --git a/src/take.rs b/src/take.rs index e7d37cc..fc2b60b 100644 --- a/src/take.rs +++ b/src/take.rs @@ -83,7 +83,7 @@ pub fn process_response<'a, 'b>( "{}", PrettyDifference { expected: &frame.response.to_string_pretty()?, - actual: &payload_response.to_string_pretty()?, + actual: &payload_response.to_string_pretty()?, } ); error!( @@ -172,12 +172,7 @@ pub fn run_take<'a>( hidden.to_coloured_tk_json()?, ]); table.printstd(); - write!( - stdout, - "{}", - format!("Press {} to continue...", "ENTER".yellow()) - ) - .expect("write to stdout panic"); + write!(stdout, "Press {} to continue...", "ENTER".yellow()).expect("write to stdout panic"); stdout.flush().expect("stdout flush panic"); // Read a single byte and discard @@ -332,10 +327,10 @@ mod tests { ) .unwrap(); let payload_response = Response { - body: Some(json!("created user: BIG_BEN")), - etc: Some(json!({})), + body: Some(json!("created user: BIG_BEN")), + etc: Some(json!({})), validation: None, - status: 200, + status: 200, }; let mut register = Register::default(); let params = Params::default();