Skip to content

Commit 631289a

Browse files
authored
Appease Clippy 1.86 (#964)
1 parent 3a938df commit 631289a

File tree

2 files changed

+14
-13
lines changed
  • crates/apollo-compiler/src

2 files changed

+14
-13
lines changed

crates/apollo-compiler/src/introspection/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub fn partial_execute(
111111
});
112112
let mut errors = Vec::new();
113113
let path = None;
114-
let data = match execute_selection_set(
114+
let data = execute_selection_set(
115115
schema,
116116
document,
117117
variable_values,
@@ -121,9 +121,12 @@ pub fn partial_execute(
121121
root_operation_object_type_def,
122122
initial_value,
123123
&operation.selection_set.selections,
124-
) {
125-
Ok(map) => Some(map),
126-
Err(PropagateNull) => None,
127-
};
124+
)
125+
// What `.ok()` below converts to `None` is a field error on a non-null field
126+
// propagated all the way to the root, so that the response JSON should contain `"data": null`.
127+
//
128+
// No-op to witness the error type:
129+
.inspect_err(|_: &PropagateNull| {})
130+
.ok();
128131
Ok(ExecutionResponse { data, errors })
129132
}

crates/apollo-compiler/src/validation/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl DiagnosticData {
291291
OutputType { .. } => "OutputType",
292292
InputType { .. } => "InputType",
293293
VariableInputType { .. } => "VariableInputType",
294-
QueryRootOperationType { .. } => "QueryRootOperationType",
294+
QueryRootOperationType => "QueryRootOperationType",
295295
UnusedVariable { .. } => "UnusedVariable",
296296
RootOperationObjectType { .. } => "RootOperationObjectType",
297297
UnionMemberObjectType { .. } => "UnionMemberObjectType",
@@ -320,9 +320,7 @@ impl DiagnosticData {
320320
Details::ExecutableBuildError(error) => Some(match error {
321321
ExecutableBuildError::UndefinedField { .. } => "UndefinedField",
322322
ExecutableBuildError::TypeSystemDefinition { .. } => "TypeSystemDefinition",
323-
ExecutableBuildError::AmbiguousAnonymousOperation { .. } => {
324-
"AmbiguousAnonymousOperation"
325-
}
323+
ExecutableBuildError::AmbiguousAnonymousOperation => "AmbiguousAnonymousOperation",
326324
ExecutableBuildError::OperationNameCollision { .. } => "OperationNameCollision",
327325
ExecutableBuildError::FragmentNameCollision { .. } => "FragmentNameCollision",
328326
ExecutableBuildError::UndefinedRootOperation { .. } => "UndefinedRootOperation",
@@ -419,7 +417,7 @@ impl DiagnosticData {
419417
VariableInputType { name, ty, .. } => Some(format!(
420418
r#"Variable "${name}" cannot be non-input type "{ty}"."#
421419
)),
422-
QueryRootOperationType { .. } => None,
420+
QueryRootOperationType => None,
423421
UnusedVariable { name } => {
424422
Some(format!(r#"Variable "${name}" is never used."#))
425423
}
@@ -681,10 +679,10 @@ impl ToCliReport for DiagnosticData {
681679
report.with_label_opt(self.location, format_args!("`{name}` redefined here"));
682680
report.with_help("remove or rename one of the definitions, or use `extend`");
683681
}
684-
SchemaBuildError::BuiltInScalarTypeRedefinition { .. } => {
682+
SchemaBuildError::BuiltInScalarTypeRedefinition => {
685683
report.with_label_opt(self.location, "remove this scalar definition");
686684
}
687-
SchemaBuildError::OrphanSchemaExtension { .. } => {
685+
SchemaBuildError::OrphanSchemaExtension => {
688686
report.with_label_opt(self.location, "extension here")
689687
}
690688
SchemaBuildError::OrphanTypeExtension { .. } => {
@@ -761,7 +759,7 @@ impl ToCliReport for DiagnosticData {
761759
self.location,
762760
"remove this definition, or use `parse_mixed()`",
763761
),
764-
ExecutableBuildError::AmbiguousAnonymousOperation { .. } => {
762+
ExecutableBuildError::AmbiguousAnonymousOperation => {
765763
report.with_label_opt(self.location, "provide a name for this definition");
766764
report.with_help(
767765
"GraphQL requires operations to be named if the document has more than one",

0 commit comments

Comments
 (0)