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 | |
| 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')
27 files changed, 239 insertions, 238 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 38ef79822c7..4e6641f4c50 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -135,7 +135,7 @@ impl PathSegment { pub fn crate_root(span: Span) -> Self { PathSegment { identifier: Ident { ctxt: span.ctxt, ..keywords::CrateRoot.ident() }, - span: span, + span, parameters: None, } } @@ -1492,15 +1492,15 @@ impl Arg { let infer_ty = P(Ty { id: DUMMY_NODE_ID, node: TyKind::ImplicitSelf, - span: span, + span, }); let arg = |mutbl, ty| Arg { pat: P(Pat { id: DUMMY_NODE_ID, node: PatKind::Ident(BindingMode::ByValue(mutbl), eself_ident, None), - span: span, + span, }), - ty: ty, + ty, id: DUMMY_NODE_ID, }; match eself.node { @@ -1509,7 +1509,7 @@ impl Arg { SelfKind::Region(lt, mutbl) => arg(Mutability::Immutable, P(Ty { id: DUMMY_NODE_ID, node: TyKind::Rptr(lt, MutTy { ty: infer_ty, mutbl: mutbl }), - span: span, + span, })), } } @@ -1738,7 +1738,7 @@ impl PolyTraitRef { PolyTraitRef { bound_lifetimes: lifetimes, trait_ref: TraitRef { path: path, ref_id: DUMMY_NODE_ID }, - span: span, + span, } } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index d5caf458fd7..a6c4c404d62 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -438,7 +438,7 @@ pub fn mk_attr_inner(span: Span, id: AttrId, item: MetaItem) -> Attribute { /// Returns an inner attribute with the given value and span. pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute { Attribute { - id: id, + id, style: ast::AttrStyle::Inner, path: ast::Path::from_ident(item.span, ast::Ident::with_empty_ctxt(item.name)), tokens: item.node.tokens(item.span), @@ -456,7 +456,7 @@ pub fn mk_attr_outer(span: Span, id: AttrId, item: MetaItem) -> Attribute { /// Returns an outer attribute with the given value and span. pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute { Attribute { - id: id, + id, style: ast::AttrStyle::Outer, path: ast::Path::from_ident(item.span, ast::Ident::with_empty_ctxt(item.name)), tokens: item.node.tokens(item.span), @@ -469,12 +469,12 @@ pub fn mk_sugared_doc_attr(id: AttrId, text: Symbol, span: Span) -> Attribute { let style = doc_comment_style(&text.as_str()); let lit = respan(span, LitKind::Str(text, ast::StrStyle::Cooked)); Attribute { - id: id, - style: style, + id, + style, path: ast::Path::from_ident(span, ast::Ident::from_str("doc")), tokens: MetaItemKind::NameValue(lit).tokens(span), is_sugared_doc: true, - span: span, + span, } } @@ -718,8 +718,8 @@ fn find_stability_generic<'a, I>(diagnostic: &Handler, match (since, reason) { (Some(since), Some(reason)) => { rustc_depr = Some(RustcDeprecation { - since: since, - reason: reason, + since, + reason, }) } (None, _) => { @@ -763,7 +763,7 @@ fn find_stability_generic<'a, I>(diagnostic: &Handler, (Some(feature), reason, Some(issue)) => { stab = Some(Stability { level: Unstable { - reason: reason, + reason, issue: { if let Ok(issue) = issue.as_str().parse() { issue @@ -774,7 +774,7 @@ fn find_stability_generic<'a, I>(diagnostic: &Handler, } } }, - feature: feature, + feature, rustc_depr: None, }) } @@ -817,9 +817,9 @@ fn find_stability_generic<'a, I>(diagnostic: &Handler, (Some(feature), Some(since)) => { stab = Some(Stability { level: Stable { - since: since, + since, }, - feature: feature, + feature, rustc_depr: None, }) } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 6c48b4cadd8..30ae7df9353 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -115,7 +115,7 @@ impl CodeMap { CodeMap { files: RefCell::new(Vec::new()), file_loader: Box::new(RealFileLoader), - path_mapping: path_mapping, + path_mapping, } } @@ -124,8 +124,8 @@ impl CodeMap { -> CodeMap { CodeMap { files: RefCell::new(Vec::new()), - file_loader: file_loader, - path_mapping: path_mapping, + file_loader, + path_mapping, } } @@ -215,13 +215,13 @@ impl CodeMap { let filemap = Rc::new(FileMap { name: filename, - name_was_remapped: name_was_remapped, - crate_of_origin: crate_of_origin, + name_was_remapped, + crate_of_origin, src: None, - src_hash: src_hash, + src_hash, external_src: RefCell::new(ExternalSource::AbsentOk), - start_pos: start_pos, - end_pos: end_pos, + start_pos, + end_pos, lines: RefCell::new(file_local_lines), multibyte_chars: RefCell::new(file_local_multibyte_chars), }); @@ -255,7 +255,7 @@ impl CodeMap { assert!(chpos >= linechpos); Loc { file: f, - line: line, + line, col: chpos - linechpos, } } @@ -385,15 +385,15 @@ impl CodeMap { let line_len = lo.file.get_line(line_index) .map(|s| s.chars().count()) .unwrap_or(0); - lines.push(LineInfo { line_index: line_index, - start_col: start_col, + lines.push(LineInfo { line_index, + start_col, end_col: CharPos::from_usize(line_len) }); start_col = CharPos::from_usize(0); } // For the last line, it extends from `start_col` to `hi.col`: lines.push(LineInfo { line_index: hi.line - 1, - start_col: start_col, + start_col, end_col: hi.col }); Ok(FileLines {file: lo.file, lines: lines}) @@ -426,7 +426,7 @@ impl CodeMap { return Err(SpanSnippetError::MalformedForCodemap( MalformedCodemapPositions { name: local_begin.fm.name.clone(), - source_len: source_len, + source_len, begin_pos: local_begin.pos, end_pos: local_end.pos, })); @@ -581,7 +581,7 @@ impl FilePathMapping { pub fn new(mapping: Vec<(String, String)>) -> FilePathMapping { FilePathMapping { - mapping: mapping + mapping, } } diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index 54e6dde41e6..14f1f8fbf8c 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -32,8 +32,8 @@ pub fn features(mut krate: ast::Crate, sess: &ParseSess, should_test: bool) let features; { let mut strip_unconfigured = StripUnconfigured { - should_test: should_test, - sess: sess, + should_test, + sess, features: None, }; @@ -105,10 +105,10 @@ impl<'a> StripUnconfigured<'a> { self.process_cfg_attr(ast::Attribute { id: attr::mk_attr_id(), style: attr.style, - path: path, - tokens: tokens, + path, + tokens, is_sugared_doc: false, - span: span, + span, }) } else { None diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 855f4cd3557..5224f52c496 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -133,7 +133,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, // Add the error to the map. with_registered_diagnostics(|diagnostics| { let info = ErrorInfo { - description: description, + description, use_site: None }; if diagnostics.insert(code.name, info).is_some() { @@ -235,7 +235,7 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, expr, ), vis: ast::Visibility::Public, - span: span, + span, tokens: None, }) ])) diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 72b2552f64f..e57d9c6fe89 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -677,10 +677,10 @@ impl<'a> ExtCtxt<'a> { resolver: &'a mut Resolver) -> ExtCtxt<'a> { ExtCtxt { - parse_sess: parse_sess, - ecfg: ecfg, + parse_sess, + ecfg, crate_root: None, - resolver: resolver, + resolver, resolve_err_count: 0, current_expansion: ExpansionData { mark: Mark::root(), diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index de0538e38b3..cbdd0013593 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -366,7 +366,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { path.segments.push(ast::PathSegment { identifier: ident.node, span: ident.span, - parameters: parameters, + parameters, }); (ast::QSelf { @@ -377,15 +377,15 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy { ast::MutTy { - ty: ty, - mutbl: mutbl + ty, + mutbl, } } fn ty(&self, span: Span, ty: ast::TyKind) -> P<ast::Ty> { P(ast::Ty { id: ast::DUMMY_NODE_ID, - span: span, + span, node: ty }) } @@ -444,15 +444,15 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ident: id, id: ast::DUMMY_NODE_ID, attrs: attrs.into(), - bounds: bounds, - default: default, - span: span + bounds, + default, + span, } } fn trait_ref(&self, path: ast::Path) -> ast::TraitRef { ast::TraitRef { - path: path, + path, ref_id: ast::DUMMY_NODE_ID, } } @@ -461,7 +461,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::PolyTraitRef { bound_lifetimes: Vec::new(), trait_ref: self.trait_ref(path), - span: span, + span, } } @@ -482,7 +482,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::LifetimeDef { attrs: attrs.into(), lifetime: self.lifetime(span, ident), - bounds: bounds + bounds, } } @@ -511,7 +511,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.pat_ident(sp, ident) }; let local = P(ast::Local { - pat: pat, + pat, ty: None, init: Some(ex), id: ast::DUMMY_NODE_ID, @@ -539,7 +539,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.pat_ident(sp, ident) }; let local = P(ast::Local { - pat: pat, + pat, ty: Some(typ), init: Some(ex), id: ast::DUMMY_NODE_ID, @@ -560,13 +560,13 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ty: Some(ty), init: None, id: ast::DUMMY_NODE_ID, - span: span, + span, attrs: ast::ThinVec::new(), }); ast::Stmt { id: ast::DUMMY_NODE_ID, node: ast::StmtKind::Local(local), - span: span, + span, } } @@ -587,18 +587,18 @@ impl<'a> AstBuilder for ExtCtxt<'a> { } fn block(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Block> { P(ast::Block { - stmts: stmts, + stmts, id: ast::DUMMY_NODE_ID, rules: BlockCheckMode::Default, - span: span, + span, }) } fn expr(&self, span: Span, node: ast::ExprKind) -> P<ast::Expr> { P(ast::Expr { id: ast::DUMMY_NODE_ID, - node: node, - span: span, + node, + span, attrs: ast::ThinVec::new(), }) } @@ -672,7 +672,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::Field { ident: respan(span, name), expr: e, - span: span, + span, is_shorthand: false, attrs: ast::ThinVec::new(), } @@ -876,7 +876,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn arm(&self, _span: Span, pats: Vec<P<ast::Pat>>, expr: P<ast::Expr>) -> ast::Arm { ast::Arm { attrs: vec![], - pats: pats, + pats, guard: None, body: expr } @@ -954,7 +954,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn arg(&self, span: Span, ident: ast::Ident, ty: P<ast::Ty>) -> ast::Arg { let arg_pat = self.pat_ident(span, ident); ast::Arg { - ty: ty, + ty, pat: arg_pat, id: ast::DUMMY_NODE_ID } @@ -963,7 +963,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { // FIXME unused self fn fn_decl(&self, inputs: Vec<ast::Arg>, output: P<ast::Ty>) -> P<ast::FnDecl> { P(ast::FnDecl { - inputs: inputs, + inputs, output: ast::FunctionRetTy::Ty(output), variadic: false }) @@ -975,11 +975,11 @@ impl<'a> AstBuilder for ExtCtxt<'a> { // Rust coding conventions P(ast::Item { ident: name, - attrs: attrs, + attrs, id: ast::DUMMY_NODE_ID, - node: node, + node, vis: ast::Visibility::Inherited, - span: span, + span, tokens: None, }) } @@ -1022,7 +1022,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let fields: Vec<_> = tys.into_iter().map(|ty| { ast::StructField { span: ty.span, - ty: ty, + ty, ident: None, vis: ast::Visibility::Inherited, attrs: Vec::new(), @@ -1038,7 +1038,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { respan(span, ast::Variant_ { - name: name, + name, attrs: Vec::new(), data: vdata, disr_expr: None, @@ -1081,7 +1081,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { attrs, ast::ItemKind::Mod(ast::Mod { inner: inner_span, - items: items, + items, }) ) } @@ -1147,7 +1147,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ident: keywords::Invalid.ident(), attrs: vec![], node: ast::ItemKind::Use(vp), - vis: vis, + vis, span: sp, tokens: None, }) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 9625602fa4a..d1172b1b2ce 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -303,7 +303,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { kind: InvocationKind::Derive { path: path.clone(), item: item }, expansion_kind: invoc.expansion_kind, expansion_data: ExpansionData { - mark: mark, + mark, ..invoc.expansion_data.clone() }, }); @@ -579,7 +579,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let pretty_name = Symbol::intern(&format!("derive({})", path)); let span = path.span; let attr = ast::Attribute { - path: path, tokens: TokenStream::empty(), span: span, + path, span, + tokens: TokenStream::empty(), // irrelevant: id: ast::AttrId(0), style: ast::AttrStyle::Outer, is_sugared_doc: false, }; @@ -714,10 +715,10 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { fn collect(&mut self, expansion_kind: ExpansionKind, kind: InvocationKind) -> Expansion { let mark = Mark::fresh(self.cx.current_expansion.mark); self.invocations.push(Invocation { - kind: kind, - expansion_kind: expansion_kind, + kind, + expansion_kind, expansion_data: ExpansionData { - mark: mark, + mark, depth: self.cx.current_expansion.depth + 1, ..self.cx.current_expansion.clone() }, @@ -876,7 +877,7 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { item.and_then(|item| match item.node { ItemKind::Mac(mac) => { self.collect(ExpansionKind::Items, InvocationKind::Bang { - mac: mac, + mac, ident: Some(item.ident), span: item.span, }).make_items() @@ -1035,7 +1036,7 @@ macro_rules! feature_tests { impl<'feat> ExpansionConfig<'feat> { pub fn default(crate_name: String) -> ExpansionConfig<'static> { ExpansionConfig { - crate_name: crate_name, + crate_name, features: None, recursion_limit: 1024, trace_mac: false, diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index e3377c1d8de..4fc2b92d3cd 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -35,7 +35,7 @@ pub fn placeholder(kind: ExpansionKind, id: ast::NodeId) -> Expansion { let vis = ast::Visibility::Inherited; let span = DUMMY_SP; let expr_placeholder = || P(ast::Expr { - id: id, span: span, + id, span, attrs: ast::ThinVec::new(), node: ast::ExprKind::Mac(mac_placeholder()), }); @@ -44,30 +44,30 @@ pub fn placeholder(kind: ExpansionKind, id: ast::NodeId) -> Expansion { ExpansionKind::Expr => Expansion::Expr(expr_placeholder()), ExpansionKind::OptExpr => Expansion::OptExpr(Some(expr_placeholder())), ExpansionKind::Items => Expansion::Items(SmallVector::one(P(ast::Item { - id: id, span: span, ident: ident, vis: vis, attrs: attrs, + id, span, ident, vis, attrs, node: ast::ItemKind::Mac(mac_placeholder()), tokens: None, }))), ExpansionKind::TraitItems => Expansion::TraitItems(SmallVector::one(ast::TraitItem { - id: id, span: span, ident: ident, attrs: attrs, + id, span, ident, attrs, node: ast::TraitItemKind::Macro(mac_placeholder()), tokens: None, })), ExpansionKind::ImplItems => Expansion::ImplItems(SmallVector::one(ast::ImplItem { - id: id, span: span, ident: ident, vis: vis, attrs: attrs, + id, span, ident, vis, attrs, node: ast::ImplItemKind::Macro(mac_placeholder()), defaultness: ast::Defaultness::Final, tokens: None, })), ExpansionKind::Pat => Expansion::Pat(P(ast::Pat { - id: id, span: span, node: ast::PatKind::Mac(mac_placeholder()), + id, span, node: ast::PatKind::Mac(mac_placeholder()), })), ExpansionKind::Ty => Expansion::Ty(P(ast::Ty { - id: id, span: span, node: ast::TyKind::Mac(mac_placeholder()), + id, span, node: ast::TyKind::Mac(mac_placeholder()), })), ExpansionKind::Stmts => Expansion::Stmts(SmallVector::one({ let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ast::ThinVec::new())); - ast::Stmt { id: id, span: span, node: ast::StmtKind::Mac(mac) } + ast::Stmt { id, span, node: ast::StmtKind::Mac(mac) } })), } } @@ -81,9 +81,9 @@ pub struct PlaceholderExpander<'a, 'b: 'a> { impl<'a, 'b> PlaceholderExpander<'a, 'b> { pub fn new(cx: &'a mut ExtCtxt<'b>, monotonic: bool) -> Self { PlaceholderExpander { - cx: cx, + cx, expansions: HashMap::new(), - monotonic: monotonic, + monotonic, } } diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 9907dfe341e..c3f3a59c302 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -383,7 +383,7 @@ pub fn unflatten(tts: Vec<TokenTree>) -> Vec<TokenTree> { } TokenTree::Token(span, token::CloseDelim(delim)) => { let tree = TokenTree::Delimited(span, Delimited { - delim: delim, + delim, tts: result.into_iter().map(TokenStream::from).collect::<TokenStream>().into(), }); result = results.pop().unwrap(); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 146bd5d9856..aea48632d5d 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -178,7 +178,7 @@ fn initial_matcher_pos(ms: Vec<TokenTree>, lo: BytePos) -> Box<MatcherPos> { sep: None, idx: 0, up: None, - matches: matches, + matches, match_lo: 0, match_cur: 0, match_hi: match_idx_hi, @@ -374,7 +374,7 @@ fn inner_parse_loop(sess: &ParseSess, stack: vec![], sep: seq.separator.clone(), idx: 0, - matches: matches, + matches, match_lo: item.match_cur, match_cur: item.match_cur, match_hi: item.match_cur + seq.num_captures, @@ -400,7 +400,7 @@ fn inner_parse_loop(sess: &ParseSess, let idx = item.idx; item.stack.push(MatcherTtFrame { elts: lower_elts, - idx: idx, + idx, }); item.idx = 0; cur_items.push(item); diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 7b3fe2bd993..983b19c5bf0 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -271,9 +271,9 @@ pub fn compile(sess: &ParseSess, features: &RefCell<Features>, def: &ast::Item) let expander: Box<_> = Box::new(MacroRulesMacroExpander { name: def.ident, - lhses: lhses, - rhses: rhses, - valid: valid, + lhses, + rhses, + valid, }); if body.legacy { diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index 6fdcadd1dde..012d4a54b36 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -191,8 +191,8 @@ fn parse_tree<I>(tree: tokenstream::TokenTree, let name_captures = macro_parser::count_names(&sequence); TokenTree::Sequence(span, Rc::new(SequenceRepetition { tts: sequence, - separator: separator, - op: op, + separator, + op, num_captures: name_captures, })) } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 2b8a733b852..7b2a31b5705 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1576,9 +1576,9 @@ pub fn check_crate(krate: &ast::Crate, unstable: UnstableFeatures) { maybe_stage_features(&sess.span_diagnostic, krate, unstable); let ctx = Context { - features: features, + features, parse_sess: sess, - plugin_attributes: plugin_attributes, + plugin_attributes, }; visit::walk_crate(&mut PostExpansionVisitor { context: &ctx }, krate); } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index a54e2573af4..6fd0a2eab42 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -375,8 +375,8 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> { TyKind::BareFn(f) => { TyKind::BareFn(f.map(|BareFnTy {lifetimes, unsafety, abi, decl}| BareFnTy { lifetimes: fld.fold_lifetime_defs(lifetimes), - unsafety: unsafety, - abi: abi, + unsafety, + abi, decl: fld.fold_fn_decl(decl) })) } @@ -387,7 +387,7 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> { let qself = qself.map(|QSelf { ty, position }| { QSelf { ty: fld.fold_ty(ty), - position: position + position, } }); TyKind::Path(qself, fld.fold_path(path)) @@ -415,7 +415,7 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> { pub fn noop_fold_foreign_mod<T: Folder>(ForeignMod {abi, items}: ForeignMod, fld: &mut T) -> ForeignMod { ForeignMod { - abi: abi, + abi, items: items.move_map(|x| fld.fold_foreign_item(x)), } } @@ -658,7 +658,7 @@ pub fn noop_fold_fn_decl<T: Folder>(decl: P<FnDecl>, fld: &mut T) -> P<FnDecl> { FunctionRetTy::Ty(ty) => FunctionRetTy::Ty(fld.fold_ty(ty)), FunctionRetTy::Default(span) => FunctionRetTy::Default(fld.new_span(span)), }, - variadic: variadic + variadic, }) } @@ -745,7 +745,7 @@ pub fn noop_fold_where_clause<T: Folder>( predicates: predicates.move_map(|predicate| { fld.fold_where_predicate(predicate) }), - span: span, + span, } } @@ -846,7 +846,7 @@ pub fn noop_fold_field<T: Folder>(f: Field, folder: &mut T) -> Field { pub fn noop_fold_mt<T: Folder>(MutTy {ty, mutbl}: MutTy, folder: &mut T) -> MutTy { MutTy { ty: folder.fold_ty(ty), - mutbl: mutbl, + mutbl, } } @@ -864,7 +864,7 @@ pub fn noop_fold_block<T: Folder>(b: P<Block>, folder: &mut T) -> P<Block> { b.map(|Block {id, stmts, rules, span}| Block { id: folder.new_id(id), stmts: stmts.move_flat_map(|s| folder.fold_stmt(s).into_iter()), - rules: rules, + rules, span: folder.new_span(span), }) } @@ -998,10 +998,10 @@ pub fn noop_fold_crate<T: Folder>(Crate {module, attrs, span}: Crate, folder: &mut T) -> Crate { let mut items = folder.fold_item(P(ast::Item { ident: keywords::Invalid.ident(), - attrs: attrs, + attrs, id: ast::DUMMY_NODE_ID, vis: ast::Visibility::Public, - span: span, + span, node: ast::ItemKind::Mod(module), tokens: None, })).into_iter(); @@ -1024,9 +1024,9 @@ pub fn noop_fold_crate<T: Folder>(Crate {module, attrs, span}: Crate, }; Crate { - module: module, - attrs: attrs, - span: span, + module, + attrs, + span, } } @@ -1048,7 +1048,7 @@ pub fn noop_fold_item_simple<T: Folder>(Item {id, ident, attrs, node, vis, span, // FIXME: if this is replaced with a call to `folder.fold_tts` it causes // an ICE during resolve... odd! - tokens: tokens, + tokens, } } @@ -1264,7 +1264,7 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span, attrs}: Expr, folder: &mu let qself = qself.map(|QSelf { ty, position }| { QSelf { ty: folder.fold_ty(ty), - position: position + position, } }); ExprKind::Path(qself, folder.fold_path(path)) diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index 695c740f405..19238c30670 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -42,7 +42,7 @@ impl JsonEmitter { code_map: Rc<CodeMap>) -> JsonEmitter { JsonEmitter { dst: Box::new(io::stderr()), - registry: registry, + registry, cm: code_map, } } @@ -56,8 +56,8 @@ impl JsonEmitter { registry: Option<Registry>, code_map: Rc<CodeMap>) -> JsonEmitter { JsonEmitter { - dst: dst, - registry: registry, + dst, + registry, cm: code_map, } } @@ -251,7 +251,7 @@ impl DiagnosticSpan { Box::new(DiagnosticSpanMacroExpansion { span: call_site, macro_decl_name: bt.macro_decl_name, - def_site_span: def_site_span, + def_site_span, }) }); DiagnosticSpan { @@ -262,11 +262,11 @@ impl DiagnosticSpan { line_end: end.line, column_start: start.col.0 + 1, column_end: end.col.0 + 1, - is_primary: is_primary, + is_primary, text: DiagnosticSpanLine::from_span(span, je), suggested_replacement: suggestion.cloned(), expansion: backtrace_step, - label: label, + label, } } @@ -351,7 +351,7 @@ impl DiagnosticCode { DiagnosticCode { code: s, - explanation: explanation, + explanation, } }) } diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index c99a09ab24e..5dc5a53e279 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -141,11 +141,11 @@ impl<'a> Parser<'a> { Ok(ast::Attribute { id: attr::mk_attr_id(), - style: style, - path: path, - tokens: tokens, + style, + path, + tokens, is_sugared_doc: false, - span: span, + span, }) } diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index 8b545d3b909..f65fffebe33 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -192,7 +192,7 @@ fn read_line_comments(rdr: &mut StringReader, if !lines.is_empty() { comments.push(Comment { style: if code_to_the_left { Trailing } else { Isolated }, - lines: lines, + lines, pos: p, }); } @@ -306,8 +306,8 @@ fn read_block_comment(rdr: &mut StringReader, } debug!("<<< block comment"); comments.push(Comment { - style: style, - lines: lines, + style, + lines, pos: p, }); } diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 09cdf26bf1f..527d2e41396 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -160,18 +160,18 @@ impl<'a> StringReader<'a> { let source_text = (*filemap.src.as_ref().unwrap()).clone(); StringReader { - sess: sess, + sess, next_pos: filemap.start_pos, pos: filemap.start_pos, col: CharPos(0), ch: Some('\n'), - filemap: filemap, + filemap, terminator: None, save_new_lines_and_multibyte: true, // dummy values; not read peek_tok: token::Eof, peek_span: syntax_pos::DUMMY_SP, - source_text: source_text, + source_text, fatal_errs: Vec::new(), token: token::Eof, span: syntax_pos::DUMMY_SP, @@ -546,7 +546,7 @@ impl<'a> StringReader<'a> { }; Some(TokenAndSpan { - tok: tok, + tok, sp: self.mk_sp(start_bpos, self.pos), }) }) @@ -675,7 +675,7 @@ impl<'a> StringReader<'a> { }; Some(TokenAndSpan { - tok: tok, + tok, sp: self.mk_sp(start_bpos, self.pos), }) }) diff --git a/src/libsyntax/parse/lexer/tokentrees.rs b/src/libsyntax/parse/lexer/tokentrees.rs index 63a396c14db..ad389ab510a 100644 --- a/src/libsyntax/parse/lexer/tokentrees.rs +++ b/src/libsyntax/parse/lexer/tokentrees.rs @@ -114,7 +114,7 @@ impl<'a> StringReader<'a> { } Ok(TokenTree::Delimited(span, Delimited { - delim: delim, + delim, tts: tts.into(), })) }, diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 957164bab79..67b4954a8f1 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -69,7 +69,7 @@ impl ParseSess { config: HashSet::new(), missing_fragment_specifiers: RefCell::new(HashSet::new()), included_mod_stack: RefCell::new(vec![]), - code_map: code_map + code_map, } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 15f05df58b5..e251d136f23 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -465,17 +465,17 @@ impl From<P<Expr>> for LhsExpr { /// Create a placeholder argument. fn dummy_arg(span: Span) -> Arg { let spanned = Spanned { - span: span, + span, node: keywords::Invalid.ident() }; let pat = P(Pat { id: ast::DUMMY_NODE_ID, node: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), spanned, None), - span: span + span, }); let ty = Ty { node: TyKind::Err, - span: span, + span, id: ast::DUMMY_NODE_ID }; Arg { ty: P(ty), pat: pat, id: ast::DUMMY_NODE_ID } @@ -489,7 +489,7 @@ impl<'a> Parser<'a> { desugar_doc_comments: bool) -> Self { let mut parser = Parser { - sess: sess, + sess, token: token::Underscore, span: syntax_pos::DUMMY_SP, prev_span: syntax_pos::DUMMY_SP, @@ -497,7 +497,7 @@ impl<'a> Parser<'a> { prev_token_kind: PrevTokenKind::Other, restrictions: Restrictions::empty(), obsolete_set: HashSet::new(), - recurse_into_file_modules: recurse_into_file_modules, + recurse_into_file_modules, directory: Directory { path: PathBuf::new(), ownership: DirectoryOwnership::Owned }, root_module_name: None, expected_tokens: Vec::new(), @@ -508,7 +508,7 @@ impl<'a> Parser<'a> { }), stack: Vec::new(), }, - desugar_doc_comments: desugar_doc_comments, + desugar_doc_comments, cfg_mods: true, }; @@ -1216,15 +1216,15 @@ impl<'a> Parser<'a> { let (inputs, variadic) = self.parse_fn_args(false, true)?; let ret_ty = self.parse_ret_ty()?; let decl = P(FnDecl { - inputs: inputs, + inputs, output: ret_ty, - variadic: variadic + variadic, }); Ok(TyKind::BareFn(P(BareFnTy { - abi: abi, - unsafety: unsafety, + abi, + unsafety, lifetimes: lifetime_defs, - decl: decl + decl, }))) } @@ -1312,11 +1312,11 @@ impl<'a> Parser<'a> { generics.where_clause = self.parse_where_clause()?; let sig = ast::MethodSig { - unsafety: unsafety, - constness: constness, + unsafety, + constness, decl: d, - generics: generics, - abi: abi, + generics, + abi, }; let body = match self.token { @@ -1344,8 +1344,8 @@ impl<'a> Parser<'a> { Ok(TraitItem { id: ast::DUMMY_NODE_ID, ident: name, - attrs: attrs, - node: node, + attrs, + node, span: lo.to(self.prev_span), tokens: None, }) @@ -1625,7 +1625,7 @@ impl<'a> Parser<'a> { Ok(Arg { ty: t, - pat: pat, + pat, id: ast::DUMMY_NODE_ID, }) } @@ -1649,7 +1649,7 @@ impl<'a> Parser<'a> { }; Ok(Arg { ty: t, - pat: pat, + pat, id: ast::DUMMY_NODE_ID }) } @@ -1934,8 +1934,8 @@ impl<'a> Parser<'a> { Ok(ast::Field { ident: respan(lo.to(hi), fieldname), span: lo.to(expr.span), - expr: expr, - is_shorthand: is_shorthand, + expr, + is_shorthand, attrs: attrs.into(), }) } @@ -1943,8 +1943,8 @@ impl<'a> Parser<'a> { pub fn mk_expr(&mut self, span: Span, node: ExprKind, attrs: ThinVec<Attribute>) -> P<Expr> { P(Expr { id: ast::DUMMY_NODE_ID, - node: node, - span: span, + node, + span, attrs: attrs.into(), }) } @@ -1990,8 +1990,8 @@ impl<'a> Parser<'a> { P(Expr { id: ast::DUMMY_NODE_ID, node: ExprKind::Mac(codemap::Spanned {node: m, span: span}), - span: span, - attrs: attrs, + span, + attrs, }) } @@ -2006,7 +2006,7 @@ impl<'a> Parser<'a> { id: ast::DUMMY_NODE_ID, node: ExprKind::Lit(lv_lit), span: *span, - attrs: attrs, + attrs, }) } @@ -3153,9 +3153,9 @@ impl<'a> Parser<'a> { } Ok(ast::Arm { - attrs: attrs, - pats: pats, - guard: guard, + attrs, + pats, + guard, body: expr, }) } @@ -3361,7 +3361,7 @@ impl<'a> Parser<'a> { node: ast::FieldPat { ident: fieldname, pat: subpat, - is_shorthand: is_shorthand, + is_shorthand, attrs: attrs.into(), } }); @@ -3597,12 +3597,12 @@ impl<'a> Parser<'a> { }; let init = self.parse_initializer()?; Ok(P(ast::Local { - ty: ty, - pat: pat, - init: init, + ty, + pat, + init, id: ast::DUMMY_NODE_ID, span: lo.to(self.prev_span), - attrs: attrs, + attrs, })) } @@ -3618,10 +3618,10 @@ impl<'a> Parser<'a> { Ok(StructField { span: lo.to(self.prev_span), ident: Some(name), - vis: vis, + vis, id: ast::DUMMY_NODE_ID, - ty: ty, - attrs: attrs, + ty, + attrs, }) } @@ -3929,7 +3929,7 @@ impl<'a> Parser<'a> { Stmt { id: ast::DUMMY_NODE_ID, span: lo.to(hi), - node: node, + node, } } else { // if it has a special ident, it's definitely an item @@ -3946,7 +3946,7 @@ impl<'a> Parser<'a> { let span = lo.to(hi); Stmt { id: ast::DUMMY_NODE_ID, - span: span, + span, node: StmtKind::Item({ self.mk_item( span, id /*id is good here*/, @@ -4083,7 +4083,7 @@ impl<'a> Parser<'a> { } Ok(P(ast::Block { - stmts: stmts, + stmts, id: ast::DUMMY_NODE_ID, rules: s, span: lo.to(self.prev_span), @@ -4227,11 +4227,11 @@ impl<'a> Parser<'a> { Ok(TyParam { attrs: preceding_attrs.into(), - ident: ident, + ident, id: ast::DUMMY_NODE_ID, - bounds: bounds, - default: default, - span: span, + bounds, + default, + span, }) } @@ -4253,8 +4253,8 @@ impl<'a> Parser<'a> { }; lifetime_defs.push(LifetimeDef { attrs: attrs.into(), - lifetime: lifetime, - bounds: bounds, + lifetime, + bounds, }); if seen_ty_param { self.span_err(self.prev_span, @@ -4297,7 +4297,7 @@ impl<'a> Parser<'a> { self.expect_gt()?; Ok(ast::Generics { lifetimes: lifetime_defs, - ty_params: ty_params, + ty_params, where_clause: WhereClause { id: ast::DUMMY_NODE_ID, predicates: Vec::new(), @@ -4334,8 +4334,8 @@ impl<'a> Parser<'a> { let ty = self.parse_ty()?; bindings.push(TypeBinding { id: ast::DUMMY_NODE_ID, - ident: ident, - ty: ty, + ident, + ty, span: lo.to(self.prev_span), }); seen_binding = true; @@ -4404,8 +4404,8 @@ impl<'a> Parser<'a> { where_clause.predicates.push(ast::WherePredicate::RegionPredicate( ast::WhereRegionPredicate { span: lo.to(self.prev_span), - lifetime: lifetime, - bounds: bounds, + lifetime, + bounds, } )); } else if self.check_type() { @@ -4427,7 +4427,7 @@ impl<'a> Parser<'a> { span: lo.to(self.prev_span), bound_lifetimes: lifetime_defs, bounded_ty: ty, - bounds: bounds, + bounds, } )); // FIXME: Decide what should be used here, `=` or `==`. @@ -4437,7 +4437,7 @@ impl<'a> Parser<'a> { ast::WhereEqPredicate { span: lo.to(self.prev_span), lhs_ty: ty, - rhs_ty: rhs_ty, + rhs_ty, id: ast::DUMMY_NODE_ID, } )); @@ -4518,7 +4518,7 @@ impl<'a> Parser<'a> { Ok(P(FnDecl { inputs: args, output: ret_ty, - variadic: variadic + variadic, })) } @@ -4679,7 +4679,7 @@ impl<'a> Parser<'a> { Ok(P(FnDecl { inputs: inputs_captures, - output: output, + output, variadic: false })) } @@ -4694,12 +4694,12 @@ impl<'a> Parser<'a> { fn mk_item(&mut self, span: Span, ident: Ident, node: ItemKind, vis: Visibility, attrs: Vec<Attribute>) -> P<Item> { P(Item { - ident: ident, - attrs: attrs, + ident, + attrs, id: ast::DUMMY_NODE_ID, - node: node, - vis: vis, - span: span, + node, + vis, + span, tokens: None, }) } @@ -4799,10 +4799,10 @@ impl<'a> Parser<'a> { id: ast::DUMMY_NODE_ID, span: lo.to(self.prev_span), ident: name, - vis: vis, - defaultness: defaultness, - attrs: attrs, - node: node, + vis, + defaultness, + attrs, + node, tokens: None, }) } @@ -4896,11 +4896,11 @@ impl<'a> Parser<'a> { *at_end = true; let (inner_attrs, body) = self.parse_inner_attrs_and_block()?; Ok((ident, inner_attrs, ast::ImplItemKind::Method(ast::MethodSig { - generics: generics, - abi: abi, - unsafety: unsafety, - constness: constness, - decl: decl + generics, + abi, + unsafety, + constness, + decl, }, body))) } } @@ -5151,11 +5151,11 @@ impl<'a> Parser<'a> { let ty = p.parse_ty()?; Ok(StructField { span: lo.to(p.span), - vis: vis, + vis, ident: None, id: ast::DUMMY_NODE_ID, - ty: ty, - attrs: attrs, + ty, + attrs, }) })?; @@ -5281,7 +5281,7 @@ impl<'a> Parser<'a> { Ok(ast::Mod { inner: inner_lo.to(hi), - items: items + items, }) } @@ -5403,7 +5403,7 @@ impl<'a> Parser<'a> { ModulePath { name: mod_name, path_exists: default_exists || secondary_exists, - result: result, + result, } } @@ -5418,7 +5418,7 @@ impl<'a> Parser<'a> { Some("mod.rs") => DirectoryOwnership::Owned, _ => DirectoryOwnership::UnownedViaMod(true), }, - path: path, + path, warn: false, }); } @@ -5509,12 +5509,12 @@ impl<'a> Parser<'a> { let hi = self.span; self.expect(&token::Semi)?; Ok(ast::ForeignItem { - ident: ident, - attrs: attrs, + ident, + attrs, node: ForeignItemKind::Fn(decl, generics), id: ast::DUMMY_NODE_ID, span: lo.to(hi), - vis: vis + vis, }) } @@ -5529,12 +5529,12 @@ impl<'a> Parser<'a> { let hi = self.span; self.expect(&token::Semi)?; Ok(ForeignItem { - ident: ident, - attrs: attrs, + ident, + attrs, node: ForeignItemKind::Static(ty, mutbl), id: ast::DUMMY_NODE_ID, span: lo.to(hi), - vis: vis + vis, }) } @@ -5596,7 +5596,7 @@ impl<'a> Parser<'a> { let prev_span = self.prev_span; let m = ast::ForeignMod { - abi: abi, + abi, items: foreign_items }; let invalid = keywords::Invalid.ident(); @@ -5647,7 +5647,7 @@ impl<'a> Parser<'a> { name: ident, attrs: variant_attrs, data: struct_def, - disr_expr: disr_expr, + disr_expr, }; variants.push(respan(vlo.to(self.prev_span), vr)); @@ -6162,7 +6162,7 @@ impl<'a> Parser<'a> { let rename = this.parse_rename()?; let node = ast::PathListItem_ { name: ident, - rename: rename, + rename, id: ast::DUMMY_NODE_ID }; Ok(respan(lo.to(this.prev_span), node)) diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 3ce9e9d07b3..5c4bf47a6db 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -246,7 +246,7 @@ pub fn mk_printer<'a>(out: Box<io::Write+'a>, linewidth: usize) -> Printer<'a> { let n: usize = 55 * linewidth; debug!("mk_printer {}", linewidth); Printer { - out: out, + out, buf_len: n, margin: linewidth as isize, space: linewidth as isize, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index e9d11e73837..3be831e828c 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -72,7 +72,7 @@ fn rust_printer<'a>(writer: Box<Write+'a>, ann: &'a PpAnn) -> State<'a> { literals: vec![].into_iter().peekable(), cur_cmnt: 0, boxes: Vec::new(), - ann: ann, + ann, } } @@ -145,11 +145,11 @@ impl<'a> State<'a> { State { s: pp::mk_printer(out, DEFAULT_COLUMNS), cm: Some(cm), - comments: comments, + comments, literals: literals.unwrap_or_default().into_iter().peekable(), cur_cmnt: 0, boxes: Vec::new(), - ann: ann, + ann, } } } diff --git a/src/libsyntax/show_span.rs b/src/libsyntax/show_span.rs index 263a4f13c1b..8ab2ba71ec1 100644 --- a/src/libsyntax/show_span.rs +++ b/src/libsyntax/show_span.rs @@ -79,8 +79,8 @@ pub fn run(span_diagnostic: &errors::Handler, None => return }; let mut v = ShowSpanVisitor { - span_diagnostic: span_diagnostic, - mode: mode, + span_diagnostic, + mode, }; visit::walk_crate(&mut v, krate); } diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs index 430976e7d3c..8977d701e5a 100644 --- a/src/libsyntax/std_inject.rs +++ b/src/libsyntax/std_inject.rs @@ -72,18 +72,18 @@ pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option<Strin tokens: TokenStream::empty(), id: attr::mk_attr_id(), is_sugared_doc: false, - span: span, + span, }], vis: ast::Visibility::Inherited, node: ast::ItemKind::Use(P(codemap::dummy_spanned(ast::ViewPathGlob(ast::Path { segments: ["{{root}}", name, "prelude", "v1"].into_iter().map(|name| { ast::PathSegment::from_ident(ast::Ident::from_str(name), DUMMY_SP) }).collect(), - span: span, + span, })))), id: ast::DUMMY_NODE_ID, ident: keywords::Invalid.ident(), - span: span, + span, tokens: None, })); diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index c05e166e013..eeb8bf72144 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -202,18 +202,18 @@ impl fold::Folder for EntryPointCleaner { allow_dead_code_item); ast::Item { - id: id, - ident: ident, + id, + ident, attrs: attrs.into_iter() .filter(|attr| { !attr.check_name("main") && !attr.check_name("start") }) .chain(iter::once(allow_dead_code)) .collect(), - node: node, - vis: vis, - span: span, - tokens: tokens, + node, + vis, + span, + tokens, } }), EntryPointType::None | @@ -243,7 +243,7 @@ fn mk_reexport_mod(cx: &mut TestCtxt, let reexport_mod = ast::Mod { inner: DUMMY_SP, - items: items, + items, }; let sym = Ident::with_empty_ctxt(Symbol::gensym("__test_reexports")); @@ -273,12 +273,12 @@ fn generate_test_harness(sess: &ParseSess, let mark = Mark::fresh(Mark::root()); let mut cx: TestCtxt = TestCtxt { - sess: sess, + sess, span_diagnostic: sd, ext_cx: ExtCtxt::new(sess, ExpansionConfig::default("test".to_string()), resolver), path: Vec::new(), testfns: Vec::new(), - reexport_test_harness_main: reexport_test_harness_main, + reexport_test_harness_main, is_test_crate: is_test_crate(&krate), toplevel_reexport: None, ctxt: SyntaxContext::empty().apply_mark(mark), @@ -296,7 +296,7 @@ fn generate_test_harness(sess: &ParseSess, }); TestHarnessGenerator { - cx: cx, + cx, tests: Vec::new(), tested_submods: Vec::new(), }.fold_crate(krate) @@ -464,10 +464,10 @@ fn mk_std(cx: &TestCtxt) -> P<ast::Item> { }; P(ast::Item { id: ast::DUMMY_NODE_ID, - ident: ident, + ident, node: vi, attrs: vec![], - vis: vis, + vis, span: sp, tokens: None, }) |
