Don't clone field names when recursing down in selection sets

This commit is contained in:
Magnus Hallin 2016-12-28 11:51:37 +01:00
parent 13903d7628
commit d7e98d955a
2 changed files with 4 additions and 4 deletions

View file

@ -27,7 +27,7 @@ pub struct Registry {
#[derive(Clone)]
pub enum FieldPath<'a> {
Root(SourcePosition),
Field(String, SourcePosition, &'a FieldPath<'a>),
Field(&'a str, SourcePosition, &'a FieldPath<'a>),
}
/// Query execution engine
@ -187,7 +187,7 @@ impl<'a, CtxT> Executor<'a, CtxT> {
#[doc(hidden)]
pub fn sub_executor(
&self,
field_name: Option<String>,
field_name: Option<&'a str>,
location: SourcePosition,
selection_set: Option<&'a [Selection]>,
)
@ -251,7 +251,7 @@ impl<'a> FieldPath<'a> {
FieldPath::Root(_) => (),
FieldPath::Field(ref name, _, ref parent) => {
parent.construct_path(acc);
acc.push(name.clone());
acc.push((*name).to_owned());
}
}
}

View file

@ -325,7 +325,7 @@ fn resolve_selection_set_into<T, CtxT>(
let exec_vars = executor.variables();
let mut sub_exec = executor.sub_executor(
Some(response_name.clone()),
Some(response_name),
start_pos.clone(),
f.selection_set.as_ref().map(|v| &v[..]));