Skip to content

Commit

Permalink
Fix new clippy lints. (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
obi1kenobi authored Jul 20, 2023
1 parent f586db7 commit 6488bf5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
6 changes: 3 additions & 3 deletions trustfall_core/src/frontend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ pub fn make_ir_for_query(schema: &Schema, query: &Query) -> Result<IRQuery, Fron
if let Err(duplicates) = check_for_duplicate_output_names(all_outputs) {
let all_vertices = collect_ir_vertices(&root_component);
let errs = make_duplicated_output_names_error(&all_vertices, duplicates);
errors.extend(errs.into_iter());
errors.extend(errs);
}

if errors.is_empty() {
Expand Down Expand Up @@ -551,7 +551,7 @@ fn fill_in_query_variables(

for fold in component.folds.values() {
if let Err(e) = fill_in_query_variables(variables, fold.component.as_ref()) {
errors.extend(e.into_iter());
errors.extend(e);
}
}

Expand Down Expand Up @@ -1328,7 +1328,7 @@ where
filter_directive,
) {
Ok(filter) => post_filters.push(filter),
Err(e) => errors.extend(e.into_iter()),
Err(e) => errors.extend(e),
}
}
for output in &transform_group.output {
Expand Down
2 changes: 1 addition & 1 deletion trustfall_core/src/interpreter/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ mismatch on whether the fold below {expanding_from_vid:?} was inside an `@option

let prior_folded_values_count = ctx.folded_values.len();
let new_folded_values_count = folded_values.len();
ctx.folded_values.extend(folded_values.into_iter());
ctx.folded_values.extend(folded_values);

// Ensure the merged maps had disjoint keys.
assert_eq!(
Expand Down
5 changes: 1 addition & 4 deletions trustfall_core/src/interpreter/hints/candidates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,10 +783,7 @@ mod tests {
}
}

for (original, intersected) in larger_ranges
.into_iter()
.cartesian_product(smaller_ranges.into_iter())
{
for (original, intersected) in larger_ranges.into_iter().cartesian_product(smaller_ranges) {
let mut expected = intersected.clone();
if let Range(r) = &mut expected {
if let Range(r2) = &original {
Expand Down
20 changes: 10 additions & 10 deletions trustfall_core/src/interpreter/hints/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ mod dynamic_property_values {
Box::new(value_candidate
.expect("no dynamic candidate for 'value' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand Down Expand Up @@ -1441,7 +1441,7 @@ mod dynamic_property_values {
Box::new(value_candidate
.expect("no dynamic candidate for 'value' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand Down Expand Up @@ -1539,7 +1539,7 @@ mod dynamic_property_values {
Box::new(candidate
.expect("no dynamic candidate for 'value' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand Down Expand Up @@ -1610,7 +1610,7 @@ mod dynamic_property_values {
Box::new(candidate
.expect("no dynamic candidate for 'name' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand Down Expand Up @@ -1664,7 +1664,7 @@ mod dynamic_property_values {
Box::new(candidate
.expect("no dynamic candidate for 'value' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand Down Expand Up @@ -1805,7 +1805,7 @@ mod dynamic_property_values {
Box::new(candidate
.expect("no dynamic candidate for 'value' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand Down Expand Up @@ -1886,7 +1886,7 @@ mod dynamic_property_values {
Box::new(candidate
.expect("no dynamic candidate for 'value' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand Down Expand Up @@ -1950,7 +1950,7 @@ mod dynamic_property_values {
Box::new(candidate
.expect("no dynamic candidate for 'value' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand All @@ -1974,7 +1974,7 @@ mod dynamic_property_values {
Box::new(candidate
.expect("no dynamic candidate for 'value' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand Down Expand Up @@ -2072,7 +2072,7 @@ mod dynamic_property_values {
Box::new(candidate
.expect("no dynamic candidate for 'value' property")
.resolve(adapter, ctxs)
.zip_longest(expected_values.into_iter())
.zip_longest(expected_values)
.map(move |data| {
if let EitherOrBoth::Both((ctx, value), expected_value) = data {
assert_eq!(expected_value, value);
Expand Down
20 changes: 12 additions & 8 deletions trustfall_core/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,29 +210,29 @@ directive @transform(op: String!) on FIELD

let mut errors = vec![];
if let Err(e) = check_required_transitive_implementations(&vertex_types) {
errors.extend(e.into_iter());
errors.extend(e);
}
if let Err(e) = check_field_type_narrowing(&vertex_types, &fields) {
errors.extend(e.into_iter());
errors.extend(e);
}
if let Err(e) = check_fields_required_by_interface_implementations(&vertex_types, &fields) {
errors.extend(e.into_iter());
errors.extend(e);
}
if let Err(e) =
check_type_and_property_and_edge_invariants(query_type_definition, &vertex_types)
{
errors.extend(e.into_iter());
errors.extend(e);
}
if let Err(e) =
check_root_query_type_invariants(query_type_definition, &query_type, &vertex_types)
{
errors.extend(e.into_iter());
errors.extend(e);
}

let field_origins = match get_field_origins(&vertex_types) {
Ok(field_origins) => {
if let Err(e) = check_ambiguous_field_origins(&fields, &field_origins) {
errors.extend(e.into_iter());
errors.extend(e);
}
Some(field_origins)
}
Expand Down Expand Up @@ -599,7 +599,9 @@ fn check_fields_required_by_interface_implementations(

for implementation in implementations {
let implementation = implementation.node.as_ref();
let Some(impl_defn) = vertex_types.get(implementation) else { continue; };
let Some(impl_defn) = vertex_types.get(implementation) else {
continue;
};

for field in get_vertex_type_fields(impl_defn) {
let field_name = field.node.name.node.as_ref();
Expand Down Expand Up @@ -806,7 +808,9 @@ fn get_field_origins(
let mut implemented_fields: BTreeMap<&str, FieldOrigin> = Default::default();
for implemented_interface in implements {
let implemented_interface = implemented_interface.node.as_ref();
let Some(implemented_defn) = vertex_types.get(implemented_interface) else { continue; };
let Some(implemented_defn) = vertex_types.get(implemented_interface) else {
continue;
};
let parent_fields = get_vertex_type_fields(implemented_defn);
for field in parent_fields {
let parent_field_origin = &field_origins[&(
Expand Down

0 comments on commit 6488bf5

Please sign in to comment.