Skip to content

Commit d7e98d9

Browse files
committed
Don't clone field names when recursing down in selection sets
1 parent 13903d7 commit d7e98d9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/executor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct Registry {
2727
#[derive(Clone)]
2828
pub enum FieldPath<'a> {
2929
Root(SourcePosition),
30-
Field(String, SourcePosition, &'a FieldPath<'a>),
30+
Field(&'a str, SourcePosition, &'a FieldPath<'a>),
3131
}
3232

3333
/// Query execution engine
@@ -187,7 +187,7 @@ impl<'a, CtxT> Executor<'a, CtxT> {
187187
#[doc(hidden)]
188188
pub fn sub_executor(
189189
&self,
190-
field_name: Option<String>,
190+
field_name: Option<&'a str>,
191191
location: SourcePosition,
192192
selection_set: Option<&'a [Selection]>,
193193
)
@@ -251,7 +251,7 @@ impl<'a> FieldPath<'a> {
251251
FieldPath::Root(_) => (),
252252
FieldPath::Field(ref name, _, ref parent) => {
253253
parent.construct_path(acc);
254-
acc.push(name.clone());
254+
acc.push((*name).to_owned());
255255
}
256256
}
257257
}

src/types/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ fn resolve_selection_set_into<T, CtxT>(
325325
let exec_vars = executor.variables();
326326

327327
let mut sub_exec = executor.sub_executor(
328-
Some(response_name.clone()),
328+
Some(response_name),
329329
start_pos.clone(),
330330
f.selection_set.as_ref().map(|v| &v[..]));
331331

0 commit comments

Comments
 (0)