Skip to content

Commit

Permalink
Address 'cargo xtask lint' feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Dec 13, 2024
1 parent df1f5fb commit 15b6b8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ fn then_method(
tail: &WithRange<PathList>,
) -> (Option<JSON>, Vec<ApplyToError>) {
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(
Expand All @@ -137,11 +137,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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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)",
Expand Down

0 comments on commit 15b6b8c

Please sign in to comment.