diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2017-08-06 22:54:09 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2017-08-15 15:29:17 -0700 |
| commit | 1b6c9605e41b7c7dc23e0e6f633f05912d0463dd (patch) | |
| tree | 2482313e8e0761fd8e3ecddc8baad7bf96689b07 /src/libsyntax_ext | |
| parent | 82be83cf744611a016fb09ae1afbffc04b3ed2e1 (diff) | |
| download | rust-1b6c9605e41b7c7dc23e0e6f633f05912d0463dd.tar.gz rust-1b6c9605e41b7c7dc23e0e6f633f05912d0463dd.zip | |
use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/asm.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/bounds.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/clone.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/eq.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/ord.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/partial_eq.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/partial_ord.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/debug.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/decodable.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/default.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/encodable.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/generic/mod.rs | 38 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/generic/ty.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/hash.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/format.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax_ext/format_foreign.rs | 18 | ||||
| -rw-r--r-- | src/libsyntax_ext/global_asm.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/proc_macro_registrar.rs | 8 |
19 files changed, 72 insertions, 72 deletions
diff --git a/src/libsyntax_ext/asm.rs b/src/libsyntax_ext/asm.rs index 923e8072f43..3742fb8c804 100644 --- a/src/libsyntax_ext/asm.rs +++ b/src/libsyntax_ext/asm.rs @@ -152,8 +152,8 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, outputs.push(ast::InlineAsmOutput { constraint: output.unwrap_or(constraint), expr: out, - is_rw: is_rw, - is_indirect: is_indirect, + is_rw, + is_indirect, }); } } @@ -242,14 +242,14 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, MacEager::expr(P(ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprKind::InlineAsm(P(ast::InlineAsm { - asm: asm, + asm, asm_str_style: asm_str_style.unwrap(), - outputs: outputs, - inputs: inputs, + outputs, + inputs, clobbers: clobs, - volatile: volatile, - alignstack: alignstack, - dialect: dialect, + volatile, + alignstack, + dialect, ctxt: cx.backtrace(), })), span: sp, diff --git a/src/libsyntax_ext/deriving/bounds.rs b/src/libsyntax_ext/deriving/bounds.rs index efb2fe5eb3b..0bc802283fb 100644 --- a/src/libsyntax_ext/deriving/bounds.rs +++ b/src/libsyntax_ext/deriving/bounds.rs @@ -34,9 +34,9 @@ pub fn expand_deriving_copy(cx: &mut ExtCtxt, let path = Path::new(v); let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), - path: path, + path, additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/clone.rs b/src/libsyntax_ext/deriving/clone.rs index 35a2a2513f4..71dd7abfab0 100644 --- a/src/libsyntax_ext/deriving/clone.rs +++ b/src/libsyntax_ext/deriving/clone.rs @@ -77,7 +77,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt, let inline = cx.meta_word(span, Symbol::intern("inline")); let attrs = vec![cx.attribute(span, inline)]; let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::clone::Clone), additional_bounds: bounds, diff --git a/src/libsyntax_ext/deriving/cmp/eq.rs b/src/libsyntax_ext/deriving/cmp/eq.rs index eef21492deb..0b57beeae85 100644 --- a/src/libsyntax_ext/deriving/cmp/eq.rs +++ b/src/libsyntax_ext/deriving/cmp/eq.rs @@ -28,7 +28,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt, let doc = cx.meta_list(span, Symbol::intern("doc"), vec![hidden]); let attrs = vec![cx.attribute(span, inline), cx.attribute(span, doc)]; let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::cmp::Eq), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/cmp/ord.rs b/src/libsyntax_ext/deriving/cmp/ord.rs index 9fc3d997585..9b057aacece 100644 --- a/src/libsyntax_ext/deriving/cmp/ord.rs +++ b/src/libsyntax_ext/deriving/cmp/ord.rs @@ -26,7 +26,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt, let inline = cx.meta_word(span, Symbol::intern("inline")); let attrs = vec![cx.attribute(span, inline)]; let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::cmp::Ord), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/cmp/partial_eq.rs b/src/libsyntax_ext/deriving/cmp/partial_eq.rs index f2a050ce971..e635c6bebcd 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_eq.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_eq.rs @@ -91,14 +91,14 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt, } let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::cmp::PartialEq), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, supports_unions: false, - methods: methods, + methods, associated_types: Vec::new(), }; trait_def.expand(cx, mitem, item, push) diff --git a/src/libsyntax_ext/deriving/cmp/partial_ord.rs b/src/libsyntax_ext/deriving/cmp/partial_ord.rs index ce4d549d696..e7e1c108760 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_ord.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_ord.rs @@ -59,7 +59,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt, generics: LifetimeBounds::empty(), explicit_self: borrowed_explicit_self(), args: vec![borrowed_self()], - ret_ty: ret_ty, + ret_ty, attributes: attrs, is_unsafe: false, unify_fieldless_variants: true, @@ -82,14 +82,14 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt, }; let trait_def = TraitDef { - span: span, + span, attributes: vec![], path: path_std!(cx, core::cmp::PartialOrd), additional_bounds: vec![], generics: LifetimeBounds::empty(), is_unsafe: false, supports_unions: false, - methods: methods, + methods, associated_types: Vec::new(), }; trait_def.expand(cx, mitem, item, push) diff --git a/src/libsyntax_ext/deriving/debug.rs b/src/libsyntax_ext/deriving/debug.rs index 38ed596098b..54d71dd4b48 100644 --- a/src/libsyntax_ext/deriving/debug.rs +++ b/src/libsyntax_ext/deriving/debug.rs @@ -28,7 +28,7 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt, Borrowed(None, ast::Mutability::Mutable)); let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::fmt::Debug), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/decodable.rs b/src/libsyntax_ext/deriving/decodable.rs index 498f2348b80..517221af1d4 100644 --- a/src/libsyntax_ext/deriving/decodable.rs +++ b/src/libsyntax_ext/deriving/decodable.rs @@ -57,7 +57,7 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt, let typaram = &*deriving::hygienic_type_parameter(item, "__D"); let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: Path::new_(vec![krate, "Decodable"], None, vec![], true), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/default.rs b/src/libsyntax_ext/deriving/default.rs index 69391f48c22..0c8e3c39395 100644 --- a/src/libsyntax_ext/deriving/default.rs +++ b/src/libsyntax_ext/deriving/default.rs @@ -26,7 +26,7 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt, let inline = cx.meta_word(span, Symbol::intern("inline")); let attrs = vec![cx.attribute(span, inline)]; let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::default::Default), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/encodable.rs b/src/libsyntax_ext/deriving/encodable.rs index 1e19cd99419..c2c862f043f 100644 --- a/src/libsyntax_ext/deriving/encodable.rs +++ b/src/libsyntax_ext/deriving/encodable.rs @@ -138,7 +138,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt, let typaram = &*deriving::hygienic_type_parameter(item, "__S"); let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: Path::new_(vec![krate, "Encodable"], None, vec![], true), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 3cbc7938bde..674facd05fd 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -381,10 +381,10 @@ fn find_type_parameters(ty: &ast::Ty, } let mut visitor = Visitor { - ty_param_names: ty_param_names, + ty_param_names, types: Vec::new(), - span: span, - cx: cx, + span, + cx, }; visit::Visitor::visit_ty(&mut visitor, ty); @@ -499,7 +499,7 @@ impl<'a> TraitDef<'a> { ast::ImplItem { id: ast::DUMMY_NODE_ID, span: self.span, - ident: ident, + ident, vis: ast::Visibility::Inherited, defaultness: ast::Defaultness::Final, attrs: Vec::new(), @@ -596,7 +596,7 @@ impl<'a> TraitDef<'a> { span: self.span, bound_lifetimes: vec![], bounded_ty: ty, - bounds: bounds, + bounds, }; let predicate = ast::WherePredicate::BoundPredicate(predicate); @@ -606,10 +606,10 @@ impl<'a> TraitDef<'a> { } let trait_generics = Generics { - lifetimes: lifetimes, - ty_params: ty_params, - where_clause: where_clause, - span: span, + lifetimes, + ty_params, + where_clause, + span, }; // Create the reference to the trait. @@ -807,11 +807,11 @@ impl<'a> MethodDef<'a> { fields: &SubstructureFields) -> P<Expr> { let substructure = Substructure { - type_ident: type_ident, + type_ident, method_ident: cx.ident_of(self.name), - self_args: self_args, - nonself_args: nonself_args, - fields: fields, + self_args, + nonself_args, + fields, }; let mut f = self.combine_substructure.borrow_mut(); let f: &mut CombineSubstructureFunc = &mut *f; @@ -924,8 +924,8 @@ impl<'a> MethodDef<'a> { ident: method_ident, node: ast::ImplItemKind::Method(ast::MethodSig { generics: fn_generics, - abi: abi, - unsafety: unsafety, + abi, + unsafety, constness: dummy_spanned(ast::Constness::NotConst), decl: fn_decl, @@ -985,7 +985,7 @@ impl<'a> MethodDef<'a> { let mut other_fields: Vec<vec::IntoIter<_>> = raw_fields.collect(); first_field.map(|(span, opt_id, field, attrs)| { FieldInfo { - span: span, + span, name: opt_id, self_: field, other: other_fields.iter_mut() @@ -995,7 +995,7 @@ impl<'a> MethodDef<'a> { } }) .collect(), - attrs: attrs, + attrs, } }) .collect() @@ -1246,7 +1246,7 @@ impl<'a> MethodDef<'a> { name: opt_ident, self_: self_getter_expr, other: others, - attrs: attrs, + attrs, } }).collect::<Vec<FieldInfo>>(); @@ -1553,7 +1553,7 @@ impl<'a> TraitDef<'a> { span: Span { ctxt: self.span.ctxt, ..pat.span }, node: ast::FieldPat { ident: ident.unwrap(), - pat: pat, + pat, is_shorthand: false, attrs: ast::ThinVec::new(), }, diff --git a/src/libsyntax_ext/deriving/generic/ty.rs b/src/libsyntax_ext/deriving/generic/ty.rs index f5ac1743920..47b5f40832a 100644 --- a/src/libsyntax_ext/deriving/generic/ty.rs +++ b/src/libsyntax_ext/deriving/generic/ty.rs @@ -55,10 +55,10 @@ impl<'a> Path<'a> { global: bool) -> Path<'r> { Path { - path: path, - lifetime: lifetime, - params: params, - global: global, + path, + lifetime, + params, + global, } } @@ -211,14 +211,14 @@ fn mk_ty_param(cx: &ExtCtxt, fn mk_generics(lifetimes: Vec<ast::LifetimeDef>, ty_params: Vec<ast::TyParam>, span: Span) -> Generics { Generics { - lifetimes: lifetimes, - ty_params: ty_params, + lifetimes, + ty_params, where_clause: ast::WhereClause { id: ast::DUMMY_NODE_ID, predicates: Vec::new(), - span: span, + span, }, - span: span, + span, } } diff --git a/src/libsyntax_ext/deriving/hash.rs b/src/libsyntax_ext/deriving/hash.rs index a341c21d0a1..6c78eea186d 100644 --- a/src/libsyntax_ext/deriving/hash.rs +++ b/src/libsyntax_ext/deriving/hash.rs @@ -30,9 +30,9 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt, let arg = Path::new_local(typaram); let hash_trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), - path: path, + path, additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs index 00dcfc7a587..cd706f14a68 100644 --- a/src/libsyntax_ext/deriving/mod.rs +++ b/src/libsyntax_ext/deriving/mod.rs @@ -173,6 +173,6 @@ fn call_intrinsic(cx: &ExtCtxt, stmts: vec![cx.stmt_expr(call)], id: ast::DUMMY_NODE_ID, rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated), - span: span, + span, })) } diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 16b06424c92..764cedfcf20 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -709,11 +709,11 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, }; let mut cx = Context { - ecx: ecx, - args: args, - arg_types: arg_types, - arg_unique_types: arg_unique_types, - names: names, + ecx, + args, + arg_types, + arg_unique_types, + names, curarg: 0, arg_index_map: Vec::new(), count_args: Vec::new(), @@ -724,7 +724,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, pieces: Vec::new(), str_pieces: Vec::new(), all_pieces_simple: true, - macsp: macsp, + macsp, fmtsp: fmt.span, }; diff --git a/src/libsyntax_ext/format_foreign.rs b/src/libsyntax_ext/format_foreign.rs index 3c802e8334d..99dae29d606 100644 --- a/src/libsyntax_ext/format_foreign.rs +++ b/src/libsyntax_ext/format_foreign.rs @@ -265,7 +265,7 @@ pub mod printf { /// Returns an iterator over all substitutions in a given string. pub fn iter_subs(s: &str) -> Substitutions { Substitutions { - s: s, + s, } } @@ -553,12 +553,12 @@ pub mod printf { let f = Format { span: start.slice_between(end).unwrap(), - parameter: parameter, - flags: flags, - width: width, - precision: precision, - length: length, - type_: type_, + parameter, + flags, + width, + precision, + length, + type_, }; Some((Substitution::Format(f), end.slice_after())) } @@ -776,7 +776,7 @@ pub mod shell { /// Returns an iterator over all substitutions in a given string. pub fn iter_subs(s: &str) -> Substitutions { Substitutions { - s: s, + s, } } @@ -933,7 +933,7 @@ mod strcursor { impl<'a> StrCursor<'a> { pub fn new_at_start(s: &'a str) -> StrCursor<'a> { StrCursor { - s: s, + s, at: 0, } } diff --git a/src/libsyntax_ext/global_asm.rs b/src/libsyntax_ext/global_asm.rs index 8b0bb8cb891..81226ba599a 100644 --- a/src/libsyntax_ext/global_asm.rs +++ b/src/libsyntax_ext/global_asm.rs @@ -56,7 +56,7 @@ pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt, attrs: Vec::new(), id: ast::DUMMY_NODE_ID, node: ast::ItemKind::GlobalAsm(P(ast::GlobalAsm { - asm: asm, + asm, ctxt: cx.backtrace(), })), vis: ast::Visibility::Inherited, diff --git a/src/libsyntax_ext/proc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_registrar.rs index 700386f68fe..a8a54a97ac3 100644 --- a/src/libsyntax_ext/proc_macro_registrar.rs +++ b/src/libsyntax_ext/proc_macro_registrar.rs @@ -69,9 +69,9 @@ pub fn modify(sess: &ParseSess, attr_macros: Vec::new(), bang_macros: Vec::new(), in_root: true, - handler: handler, - is_proc_macro_crate: is_proc_macro_crate, - is_test_crate: is_test_crate, + handler, + is_proc_macro_crate, + is_test_crate, }; visit::walk_crate(&mut collect, &krate); (collect.derives, collect.attr_macros, collect.bang_macros) @@ -183,7 +183,7 @@ impl<'a> CollectProcMacros<'a> { if self.in_root && item.vis == ast::Visibility::Public { self.derives.push(ProcMacroDerive { span: item.span, - trait_name: trait_name, + trait_name, function_name: item.ident, attrs: proc_attrs, }); |
