Opt for .cloned() over .map(|x| x.clone()) etc.
This commit is contained in:
parent
5705d48e28
commit
2f586b9687
39 changed files with 67 additions and 81 deletions
|
|
@ -639,7 +639,7 @@ impl<'a> ExtCtxt<'a> {
|
|||
pub fn mod_path(&self) -> Vec<ast::Ident> {
|
||||
let mut v = Vec::new();
|
||||
v.push(token::str_to_ident(&self.ecfg.crate_name[]));
|
||||
v.extend(self.mod_path.iter().map(|a| *a));
|
||||
v.extend(self.mod_path.iter().cloned());
|
||||
return v;
|
||||
}
|
||||
pub fn bt_push(&mut self, ei: ExpnInfo) {
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ impl<'a> TraitDef<'a> {
|
|||
"allow" | "warn" | "deny" | "forbid" => true,
|
||||
_ => false,
|
||||
}
|
||||
}).map(|a| a.clone()));
|
||||
}).cloned());
|
||||
push(P(ast::Item {
|
||||
attrs: attrs,
|
||||
..(*newitem).clone()
|
||||
|
|
@ -410,7 +410,7 @@ impl<'a> TraitDef<'a> {
|
|||
let mut ty_params = ty_params.into_vec();
|
||||
|
||||
// Copy the lifetimes
|
||||
lifetimes.extend(generics.lifetimes.iter().map(|l| (*l).clone()));
|
||||
lifetimes.extend(generics.lifetimes.iter().cloned());
|
||||
|
||||
// Create the type parameters.
|
||||
ty_params.extend(generics.ty_params.iter().map(|ty_param| {
|
||||
|
|
@ -445,14 +445,14 @@ impl<'a> TraitDef<'a> {
|
|||
span: self.span,
|
||||
bound_lifetimes: wb.bound_lifetimes.clone(),
|
||||
bounded_ty: wb.bounded_ty.clone(),
|
||||
bounds: OwnedSlice::from_vec(wb.bounds.iter().map(|b| b.clone()).collect())
|
||||
bounds: OwnedSlice::from_vec(wb.bounds.iter().cloned().collect())
|
||||
})
|
||||
}
|
||||
ast::WherePredicate::RegionPredicate(ref rb) => {
|
||||
ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate {
|
||||
span: self.span,
|
||||
lifetime: rb.lifetime,
|
||||
bounds: rb.bounds.iter().map(|b| b.clone()).collect()
|
||||
bounds: rb.bounds.iter().cloned().collect()
|
||||
})
|
||||
}
|
||||
ast::WherePredicate::EqPredicate(ref we) => {
|
||||
|
|
@ -500,7 +500,7 @@ impl<'a> TraitDef<'a> {
|
|||
let opt_trait_ref = Some(trait_ref);
|
||||
let ident = ast_util::impl_pretty_name(&opt_trait_ref, &*self_type);
|
||||
let mut a = vec![attr];
|
||||
a.extend(self.attributes.iter().map(|a| a.clone()));
|
||||
a.extend(self.attributes.iter().cloned());
|
||||
cx.item(
|
||||
self.span,
|
||||
ident,
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
return DummyResult::expr(sp);
|
||||
}
|
||||
Ok(bytes) => {
|
||||
let bytes = bytes.iter().map(|x| *x).collect();
|
||||
let bytes = bytes.iter().cloned().collect();
|
||||
base::MacExpr::new(cx.expr_lit(sp, ast::LitBinary(Rc::new(bytes))))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ pub fn parse(sess: &ParseSess,
|
|||
-> ParseResult {
|
||||
let mut cur_eis = Vec::new();
|
||||
cur_eis.push(initial_matcher_pos(Rc::new(ms.iter()
|
||||
.map(|x| (*x).clone())
|
||||
.cloned()
|
||||
.collect()),
|
||||
None,
|
||||
rdr.peek().sp.lo));
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
|
|||
None,
|
||||
None,
|
||||
arg.iter()
|
||||
.map(|x| (*x).clone())
|
||||
.cloned()
|
||||
.collect(),
|
||||
true);
|
||||
match parse(cx.parse_sess(), cx.cfg(), arg_rdr, lhs_tt) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue