diff --git a/apollo-federation/src/sources/connect/json_selection/methods/future.rs b/apollo-federation/src/sources/connect/json_selection/methods/future.rs index 5e12ccfdfc..9ffd71dac8 100644 --- a/apollo-federation/src/sources/connect/json_selection/methods/future.rs +++ b/apollo-federation/src/sources/connect/json_selection/methods/future.rs @@ -121,7 +121,7 @@ fn then_method( tail: &WithRange, ) -> (Option, Vec) { if let Some(MethodArgs { args, .. }) = method_args { - if args.len() < 1 || args.len() > 2 { + if args.is_empty() || args.len() > 2 { ( None, vec![ApplyToError::new( @@ -136,11 +136,11 @@ fn then_method( } else if is_truthy(data) { args[0] .apply_to_path(data, vars, input_path) - .and_then_collecting_errors(|value| tail.apply_to_path(&value, vars, input_path)) + .and_then_collecting_errors(|value| tail.apply_to_path(value, vars, input_path)) } else if args.len() > 1 { args[1] .apply_to_path(data, vars, input_path) - .and_then_collecting_errors(|value| tail.apply_to_path(&value, vars, input_path)) + .and_then_collecting_errors(|value| tail.apply_to_path(value, vars, input_path)) } else { // Allows ... $(false)->then(expression) to have no output keys. (None, Vec::new()) diff --git a/apollo-federation/src/sources/connect/json_selection/parser.rs b/apollo-federation/src/sources/connect/json_selection/parser.rs index bb6d8a384f..90a886ffc4 100644 --- a/apollo-federation/src/sources/connect/json_selection/parser.rs +++ b/apollo-federation/src/sources/connect/json_selection/parser.rs @@ -414,6 +414,7 @@ impl NamedSelection { path, inline, } => { + #[allow(clippy::if_same_then_else)] if let Some(alias) = alias { vec![alias.name.as_str()] } else if let Some(sub) = path.next_subselection() { @@ -820,7 +821,7 @@ impl PathList { // If we failed to parse "." Key above, but the input starts with a '.' // character, it's an error unless it's the beginning of a ... token. - if input.fragment().starts_with(".") && !input.fragment().starts_with("...") { + if input.fragment().starts_with('.') && !input.fragment().starts_with("...") { return Err(nom_fail_message( input, "Path selection . must be followed by key (identifier or quoted string literal)",