clippy::redudant_borrow

This commit is contained in:
Maan2003 2021-06-13 09:24:16 +05:30
parent d6737e55fb
commit c9b4ac5be4
No known key found for this signature in database
GPG key ID: E9AF024BA63C70ED
114 changed files with 285 additions and 285 deletions

View file

@ -55,7 +55,7 @@ pub(super) fn transcribe(
template: &MetaTemplate,
bindings: &Bindings,
) -> ExpandResult<tt::Subtree> {
let mut ctx = ExpandCtx { bindings: &bindings, nesting: Vec::new() };
let mut ctx = ExpandCtx { bindings: bindings, nesting: Vec::new() };
let mut arena: Vec<tt::TokenTree> = Vec::new();
expand_subtree(&mut ctx, template, None, &mut arena)
}
@ -91,12 +91,12 @@ fn expand_subtree(
Op::Leaf(tt) => arena.push(tt.clone().into()),
Op::Subtree { tokens, delimiter } => {
let ExpandResult { value: tt, err: e } =
expand_subtree(ctx, &tokens, *delimiter, arena);
expand_subtree(ctx, tokens, *delimiter, arena);
err = err.or(e);
arena.push(tt.into());
}
Op::Var { name, id, .. } => {
let ExpandResult { value: fragment, err: e } = expand_var(ctx, &name, *id);
let ExpandResult { value: fragment, err: e } = expand_var(ctx, name, *id);
err = err.or(e);
push_fragment(arena, fragment);
}
@ -141,7 +141,7 @@ fn expand_var(ctx: &mut ExpandCtx, v: &SmolStr, id: tt::TokenId) -> ExpandResult
.into();
ExpandResult::ok(Fragment::Tokens(tt))
} else {
ctx.bindings.get(&v, &mut ctx.nesting).map_or_else(
ctx.bindings.get(v, &mut ctx.nesting).map_or_else(
|e| ExpandResult { value: Fragment::Tokens(tt::TokenTree::empty()), err: Some(e) },
|b| ExpandResult::ok(b.clone()),
)