Skip to content

Commit 09cef77

Browse files
committed
Satisfy mismatched_lifetime_syntaxes rustc lint on nightly
1 parent b9e94a6 commit 09cef77

File tree

6 files changed

+38
-40
lines changed

6 files changed

+38
-40
lines changed

juniper/src/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,11 +626,11 @@ impl<'a, S> Arguments<'a, S> {
626626
self.items.into_iter()
627627
}
628628

629-
pub fn iter(&self) -> slice::Iter<(Spanning<&'a str>, Spanning<InputValue<S>>)> {
629+
pub fn iter(&self) -> slice::Iter<'_, (Spanning<&'a str>, Spanning<InputValue<S>>)> {
630630
self.items.iter()
631631
}
632632

633-
pub fn iter_mut(&mut self) -> slice::IterMut<(Spanning<&'a str>, Spanning<InputValue<S>>)> {
633+
pub fn iter_mut(&mut self) -> slice::IterMut<'_, (Spanning<&'a str>, Spanning<InputValue<S>>)> {
634634
self.items.iter_mut()
635635
}
636636

@@ -648,7 +648,7 @@ impl<'a, S> Arguments<'a, S> {
648648
}
649649

650650
impl<'a, S> VariableDefinitions<'a, S> {
651-
pub fn iter(&self) -> slice::Iter<(Spanning<&'a str>, VariableDefinition<'a, S>)> {
651+
pub fn iter(&self) -> slice::Iter<'_, (Spanning<&'a str>, VariableDefinition<'a, S>)> {
652652
self.items.iter()
653653
}
654654
}

juniper/src/executor/look_ahead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ mod tests {
819819

820820
use super::*;
821821

822-
fn parse_document_source<S>(q: &str) -> UnlocatedParseResult<OwnedDocument<S>>
822+
fn parse_document_source<S>(q: &str) -> UnlocatedParseResult<OwnedDocument<'_, S>>
823823
where
824824
S: ScalarValue,
825825
{

juniper/src/parser/tests/document.rs

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{
88
value::{DefaultScalarValue, ScalarValue},
99
};
1010

11-
fn parse_document<S>(s: &str) -> OwnedDocument<S>
11+
fn parse_document<S>(s: &str) -> OwnedDocument<'_, S>
1212
where
1313
S: ScalarValue,
1414
{
@@ -33,46 +33,44 @@ fn parse_document_error<S: ScalarValue>(s: &str) -> Spanning<ParseError> {
3333
fn simple_ast() {
3434
assert_eq!(
3535
parse_document::<DefaultScalarValue>(
36-
r#"
37-
{
36+
r#"{
3837
node(id: 4) {
3938
id
4039
name
4140
}
42-
}
43-
"#
41+
}"#,
4442
),
4543
vec![Definition::Operation(Spanning::start_end(
46-
&SourcePosition::new(13, 1, 12),
47-
&SourcePosition::new(124, 6, 13),
44+
&SourcePosition::new(0, 0, 0),
45+
&SourcePosition::new(111, 5, 13),
4846
Operation {
4947
operation_type: OperationType::Query,
5048
name: None,
5149
variable_definitions: None,
5250
directives: None,
5351
selection_set: vec![Selection::Field(Spanning::start_end(
54-
&SourcePosition::new(31, 2, 16),
55-
&SourcePosition::new(110, 5, 17),
52+
&SourcePosition::new(18, 1, 16),
53+
&SourcePosition::new(97, 4, 17),
5654
Field {
5755
alias: None,
5856
name: Spanning::start_end(
59-
&SourcePosition::new(31, 2, 16),
60-
&SourcePosition::new(35, 2, 20),
57+
&SourcePosition::new(18, 1, 16),
58+
&SourcePosition::new(22, 1, 20),
6159
"node",
6260
),
6361
arguments: Some(Spanning::start_end(
64-
&SourcePosition::new(35, 2, 20),
65-
&SourcePosition::new(42, 2, 27),
62+
&SourcePosition::new(22, 1, 20),
63+
&SourcePosition::new(29, 1, 27),
6664
Arguments {
6765
items: vec![(
6866
Spanning::start_end(
69-
&SourcePosition::new(36, 2, 21),
70-
&SourcePosition::new(38, 2, 23),
67+
&SourcePosition::new(23, 1, 21),
68+
&SourcePosition::new(25, 1, 23),
7169
"id",
7270
),
7371
Spanning::start_end(
74-
&SourcePosition::new(40, 2, 25),
75-
&SourcePosition::new(41, 2, 26),
72+
&SourcePosition::new(27, 1, 25),
73+
&SourcePosition::new(28, 1, 26),
7674
graphql_input_value!(4),
7775
),
7876
)],
@@ -81,13 +79,13 @@ fn simple_ast() {
8179
directives: None,
8280
selection_set: Some(vec![
8381
Selection::Field(Spanning::start_end(
84-
&SourcePosition::new(65, 3, 20),
85-
&SourcePosition::new(67, 3, 22),
82+
&SourcePosition::new(52, 2, 20),
83+
&SourcePosition::new(54, 2, 22),
8684
Field {
8785
alias: None,
8886
name: Spanning::start_end(
89-
&SourcePosition::new(65, 3, 20),
90-
&SourcePosition::new(67, 3, 22),
87+
&SourcePosition::new(52, 2, 20),
88+
&SourcePosition::new(54, 2, 22),
9189
"id",
9290
),
9391
arguments: None,
@@ -96,13 +94,13 @@ fn simple_ast() {
9694
},
9795
)),
9896
Selection::Field(Spanning::start_end(
99-
&SourcePosition::new(88, 4, 20),
100-
&SourcePosition::new(92, 4, 24),
97+
&SourcePosition::new(75, 3, 20),
98+
&SourcePosition::new(79, 3, 24),
10199
Field {
102100
alias: None,
103101
name: Spanning::start_end(
104-
&SourcePosition::new(88, 4, 20),
105-
&SourcePosition::new(92, 4, 24),
102+
&SourcePosition::new(75, 3, 20),
103+
&SourcePosition::new(79, 3, 24),
106104
"name",
107105
),
108106
arguments: None,

juniper/src/schema/model.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl<S> SchemaType<S> {
310310
}
311311

312312
/// Get a type by name.
313-
pub fn type_by_name(&self, name: impl AsRef<str>) -> Option<TypeType<S>> {
313+
pub fn type_by_name(&self, name: impl AsRef<str>) -> Option<TypeType<'_, S>> {
314314
self.types.get(name.as_ref()).map(|t| TypeType::Concrete(t))
315315
}
316316

@@ -329,7 +329,7 @@ impl<S> SchemaType<S> {
329329
}
330330

331331
/// Get the query type from the schema.
332-
pub fn query_type(&self) -> TypeType<S> {
332+
pub fn query_type(&self) -> TypeType<'_, S> {
333333
TypeType::Concrete(
334334
self.types
335335
.get(self.query_type_name.as_str())
@@ -345,7 +345,7 @@ impl<S> SchemaType<S> {
345345
}
346346

347347
/// Get the mutation type from the schema.
348-
pub fn mutation_type(&self) -> Option<TypeType<S>> {
348+
pub fn mutation_type(&self) -> Option<TypeType<'_, S>> {
349349
self.mutation_type_name.as_ref().map(|name| {
350350
self.type_by_name(name)
351351
.expect("Mutation type does not exist in schema")
@@ -361,7 +361,7 @@ impl<S> SchemaType<S> {
361361
}
362362

363363
/// Get the subscription type.
364-
pub fn subscription_type(&self) -> Option<TypeType<S>> {
364+
pub fn subscription_type(&self) -> Option<TypeType<'_, S>> {
365365
self.subscription_type_name.as_ref().map(|name| {
366366
self.type_by_name(name)
367367
.expect("Subscription type does not exist in schema")
@@ -377,7 +377,7 @@ impl<S> SchemaType<S> {
377377
}
378378

379379
/// Get a list of types.
380-
pub fn type_list(&self) -> Vec<TypeType<S>> {
380+
pub fn type_list(&self) -> Vec<TypeType<'_, S>> {
381381
let mut types = self
382382
.types
383383
.values()
@@ -393,7 +393,7 @@ impl<S> SchemaType<S> {
393393
}
394394

395395
/// Make a type.
396-
pub fn make_type(&self, ty: &Type<impl AsRef<str>>) -> TypeType<S> {
396+
pub fn make_type(&self, ty: &Type<impl AsRef<str>>) -> TypeType<'_, S> {
397397
match ty {
398398
Type::List(inner, expected_size) => {
399399
TypeType::List(Box::new(self.make_type(inner)), *expected_size)

juniper/src/schema/schema.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<S: ScalarValue> SchemaType<S> {
142142
self.description.as_ref()
143143
}
144144

145-
fn types(&self) -> Vec<TypeType<S>> {
145+
fn types(&self) -> Vec<TypeType<'_, S>> {
146146
self.type_list()
147147
.into_iter()
148148
.filter(|t| {
@@ -157,17 +157,17 @@ impl<S: ScalarValue> SchemaType<S> {
157157
}
158158

159159
#[graphql(name = "queryType")]
160-
fn query_type_(&self) -> TypeType<S> {
160+
fn query_type_(&self) -> TypeType<'_, S> {
161161
self.query_type()
162162
}
163163

164164
#[graphql(name = "mutationType")]
165-
fn mutation_type_(&self) -> Option<TypeType<S>> {
165+
fn mutation_type_(&self) -> Option<TypeType<'_, S>> {
166166
self.mutation_type()
167167
}
168168

169169
#[graphql(name = "subscriptionType")]
170-
fn subscription_type_(&self) -> Option<TypeType<S>> {
170+
fn subscription_type_(&self) -> Option<TypeType<'_, S>> {
171171
self.subscription_type()
172172
}
173173

juniper/src/validation/rules/overlapping_fields_can_be_merged.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<K: Eq + Hash + Clone, V> OrderedMap<K, V> {
5656
}
5757
}
5858

59-
fn iter(&self) -> OrderedMapIter<K, V> {
59+
fn iter(&self) -> OrderedMapIter<'_, K, V> {
6060
OrderedMapIter {
6161
map: &self.data,
6262
inner: self.insert_order.iter(),

0 commit comments

Comments
 (0)