Skip to content

Commit b9257ef

Browse files
authored
Fix Clippy warnings (#980)
1 parent 6bb34b9 commit b9257ef

File tree

21 files changed

+36
-38
lines changed

21 files changed

+36
-38
lines changed

integration_tests/async_await/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use juniper::{
2-
graphql_object, graphql_value, EmptyMutation, EmptySubscription, GraphQLEnum, GraphQLError,
3-
RootNode, Value,
4-
};
1+
use juniper::{graphql_object, GraphQLEnum};
52

63
#[derive(GraphQLEnum)]
74
enum UserKind {

juniper/src/executor/look_ahead.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ where
8787

8888
/// The argument's name
8989
pub fn name(&'a self) -> &str {
90-
&self.name
90+
self.name
9191
}
9292

9393
/// The value of the argument
@@ -289,7 +289,7 @@ where
289289
fragments,
290290
);
291291
assert!(s.is_none());
292-
if let Some(ref c) = inline.item.type_condition.as_ref().map(|t| t.item) {
292+
if let Some(c) = inline.item.type_condition.as_ref().map(|t| t.item) {
293293
if let Some(p) = parent.children.last_mut() {
294294
p.applies_for = Applies::OnlyType(c);
295295
}
@@ -308,7 +308,7 @@ where
308308
.children
309309
.iter()
310310
.filter_map(|c| match c.applies_for {
311-
Applies::OnlyType(ref t) if *t == type_name => {
311+
Applies::OnlyType(t) if t == type_name => {
312312
Some(c.inner.for_explicit_type(type_name))
313313
}
314314
Applies::All => Some(c.inner.for_explicit_type(type_name)),

juniper/src/executor/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ where
689689
}
690690
});
691691
if let Some(p) = found_field {
692-
LookAheadSelection::build_from_selection(&p, self.variables, self.fragments)
692+
LookAheadSelection::build_from_selection(p, self.variables, self.fragments)
693693
} else {
694694
None
695695
}

juniper/src/http/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ where
4747
{
4848
// TODO: Remove in 0.17 `juniper` version.
4949
/// Returns the `operation_name` associated with this request.
50-
#[deprecated(since = "0.16", note = "Use the direct field access instead.")]
50+
#[deprecated(since = "0.16.0", note = "Use the direct field access instead.")]
5151
pub fn operation_name(&self) -> Option<&str> {
5252
self.operation_name.as_deref()
5353
}

juniper/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ where
335335
let operation = get_operation(&document, operation_name)?;
336336

337337
{
338-
let errors = validate_input_values(&variables, operation, &root_node.schema);
338+
let errors = validate_input_values(variables, operation, &root_node.schema);
339339

340340
if !errors.is_empty() {
341341
return Err(GraphQLError::ValidationError(errors));

juniper/src/parser/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ impl<T> Spanning<T> {
5959
}
6060

6161
#[doc(hidden)]
62+
#[allow(clippy::self_named_constructors)]
6263
pub fn spanning(v: Vec<Spanning<T>>) -> Option<Spanning<Vec<Spanning<T>>>> {
6364
if let (Some(start), Some(end)) = (v.first().map(|s| s.start), v.last().map(|s| s.end)) {
6465
Some(Spanning {

juniper/src/schema/meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ impl<'a, S> MetaType<'a, S> {
399399
.iter()
400400
.filter_map(|n| schema.concrete_type_by_name(n))
401401
.filter_map(|t| t.fields(schema))
402-
.flat_map(|f| f)
402+
.flatten()
403403
.collect(),
404404
),
405405
_ => None,

juniper/src/schema/translate/graphql_parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl GraphQLParserTranslator {
256256
.map(|a| {
257257
a.iter()
258258
.filter(|x| !x.is_builtin())
259-
.map(|x| GraphQLParserTranslator::translate_argument(&x))
259+
.map(|x| GraphQLParserTranslator::translate_argument(x))
260260
.collect()
261261
})
262262
.unwrap_or_else(Vec::new);
@@ -300,7 +300,7 @@ fn generate_directives<'a, T>(status: &DeprecationStatus) -> Vec<ExternalDirecti
300300
where
301301
T: Text<'a>,
302302
{
303-
if let Some(d) = deprecation_to_directive(&status) {
303+
if let Some(d) = deprecation_to_directive(status) {
304304
vec![d]
305305
} else {
306306
vec![]

juniper/src/tests/fixtures/starwars/schema.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ impl Database {
361361
}
362362

363363
pub fn get_character(&self, id: &str) -> Option<CharacterValue> {
364+
#[allow(clippy::manual_map)]
364365
if let Some(h) = self.humans.get(id) {
365366
Some(h.clone().into())
366367
} else if let Some(d) = self.droids.get(id) {

juniper/src/types/async_await.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ where
241241
let exec_vars = executor.variables();
242242

243243
let sub_exec = executor.field_sub_executor(
244-
&response_name,
244+
response_name,
245245
f.name.item,
246246
*start_pos,
247247
f.selection_set.as_ref().map(|v| &v[..]),
@@ -309,7 +309,7 @@ where
309309
let type_name = instance.type_name(info);
310310
if executor
311311
.schema()
312-
.is_named_subtype(&concrete_type_name, &fragment.type_condition.item)
312+
.is_named_subtype(&concrete_type_name, fragment.type_condition.item)
313313
|| Some(fragment.type_condition.item) == type_name
314314
{
315315
let sub_result = instance
@@ -355,7 +355,7 @@ where
355355
let concrete_type_name = instance.concrete_type_name(sub_exec.context(), info);
356356
if executor
357357
.schema()
358-
.is_named_subtype(&concrete_type_name, &type_condition.item)
358+
.is_named_subtype(&concrete_type_name, type_condition.item)
359359
{
360360
let sub_result = instance
361361
.resolve_into_type_async(

0 commit comments

Comments
 (0)