Skip to content

Commit 0085448

Browse files
committed
fix(lint): remove needless borrows in @oneOf validation tests
clippy::needless_borrow fired on `&schema` at 9 call sites in tests/validation/one_of.rs — the compiler auto-derefs, so the explicit borrow is redundant.
1 parent e8a9e22 commit 0085448

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

crates/apollo-compiler/tests/validation/one_of.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn invalid_one_of_non_null_field_with_default() {
181181
fn valid_one_of_single_string_field() {
182182
let schema = schema_with_one_of();
183183
ExecutableDocument::parse_and_validate(
184-
&schema,
184+
schema,
185185
r#"{ oneOfField(arg: { stringField: "hello" }) }"#,
186186
"query.graphql",
187187
)
@@ -192,7 +192,7 @@ fn valid_one_of_single_string_field() {
192192
fn valid_one_of_single_int_field() {
193193
let schema = schema_with_one_of();
194194
ExecutableDocument::parse_and_validate(
195-
&schema,
195+
schema,
196196
r#"{ oneOfField(arg: { intField: 42 }) }"#,
197197
"query.graphql",
198198
)
@@ -207,7 +207,7 @@ fn valid_one_of_single_int_field() {
207207
fn invalid_one_of_no_fields() {
208208
let schema = schema_with_one_of();
209209
let errors = ExecutableDocument::parse_and_validate(
210-
&schema,
210+
schema,
211211
r#"{ oneOfField(arg: {}) }"#,
212212
"query.graphql",
213213
)
@@ -232,7 +232,7 @@ fn invalid_one_of_no_fields() {
232232
fn invalid_one_of_multiple_fields() {
233233
let schema = schema_with_one_of();
234234
let errors = ExecutableDocument::parse_and_validate(
235-
&schema,
235+
schema,
236236
r#"{ oneOfField(arg: { stringField: "a", intField: 1 }) }"#,
237237
"query.graphql",
238238
)
@@ -257,7 +257,7 @@ fn invalid_one_of_multiple_fields() {
257257
fn invalid_one_of_null_field() {
258258
let schema = schema_with_one_of();
259259
let errors = ExecutableDocument::parse_and_validate(
260-
&schema,
260+
schema,
261261
r#"{ oneOfField(arg: { stringField: null }) }"#,
262262
"query.graphql",
263263
)
@@ -295,7 +295,7 @@ fn invalid_one_of_null_field() {
295295
fn invalid_one_of_nullable_variable() {
296296
let schema = schema_with_one_of();
297297
let errors = ExecutableDocument::parse_and_validate(
298-
&schema,
298+
schema,
299299
r#"query Q($var: String) { oneOfField(arg: { stringField: $var }) }"#,
300300
"query.graphql",
301301
)
@@ -321,7 +321,7 @@ fn invalid_one_of_nullable_variable() {
321321
fn valid_one_of_non_null_variable() {
322322
let schema = schema_with_one_of();
323323
ExecutableDocument::parse_and_validate(
324-
&schema,
324+
schema,
325325
r#"query Q($var: String!) { oneOfField(arg: { stringField: $var }) }"#,
326326
"query.graphql",
327327
)
@@ -334,7 +334,7 @@ fn valid_one_of_non_null_variable() {
334334
fn invalid_one_of_undefined_variable_no_oneof_error() {
335335
let schema = schema_with_one_of();
336336
let errors = ExecutableDocument::parse_and_validate(
337-
&schema,
337+
schema,
338338
r#"{ oneOfField(arg: { stringField: $undeclared }) }"#,
339339
"query.graphql",
340340
)
@@ -372,13 +372,13 @@ fn introspection_is_one_of_true() {
372372
}
373373
"#;
374374

375-
let document = ExecutableDocument::parse_and_validate(&schema, query, "query.graphql")
375+
let document = ExecutableDocument::parse_and_validate(schema, query, "query.graphql")
376376
.expect("introspection query should be valid");
377377

378378
let operation = document.operations.get(None).unwrap();
379-
let variables = coerce_variable_values(&schema, operation, &JsonMap::default()).unwrap();
379+
let variables = coerce_variable_values(schema, operation, &JsonMap::default()).unwrap();
380380
let response = introspection::partial_execute(
381-
&schema,
381+
schema,
382382
&schema.implementers_map(),
383383
&document,
384384
operation,

fuzz/fuzz_targets/one_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
//! discarding malformed SDL — giving much better coverage of the validation
1414
//! logic than a plain-text target would.
1515
#![no_main]
16-
use apollo_rs_fuzz::generate_valid_document;
1716
use apollo_compiler::Schema;
17+
use apollo_rs_fuzz::generate_valid_document;
1818
use libfuzzer_sys::fuzz_target;
1919
use log::debug;
2020

0 commit comments

Comments
 (0)