diff --git a/src/librustc_data_structures/vec_linked_list.rs b/src/librustc_data_structures/vec_linked_list.rs index c00c707a435427b985b878f6dc53dae387667c51..0fb8060031843a156cf2344ec194a07bb6e95c09 100644 --- a/src/librustc_data_structures/vec_linked_list.rs +++ b/src/librustc_data_structures/vec_linked_list.rs @@ -8,7 +8,7 @@ pub fn iter( Ls: Links, { VecLinkedListIterator { - links: links, + links, current: first, } } diff --git a/src/librustc_errors/annotate_snippet_emitter_writer.rs b/src/librustc_errors/annotate_snippet_emitter_writer.rs index 7ed2fddf72d23a3b49c9c59a9ebe62acf9e7c14e..3641d355ef19c9aa08a7758e0771f43267db4e3c 100644 --- a/src/librustc_errors/annotate_snippet_emitter_writer.rs +++ b/src/librustc_errors/annotate_snippet_emitter_writer.rs @@ -94,7 +94,7 @@ fn to_annotation_snippet(&self) -> Option { annotation_type: Self::annotation_type_for_level(self.level), }), footer: vec![], - slices: slices, + slices, }) } else { // FIXME(#59346): Is it ok to return None if there's no source_map? diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index fc1fd960c4acea3397b140fcab6b9d340366cf58..424d7c00383899897bafda051fedc4c61470dae1 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -388,7 +388,7 @@ pub fn tool_only_span_suggestion( }], msg: msg.to_owned(), style: SuggestionStyle::CompletelyHidden, - applicability: applicability, + applicability, }); self } diff --git a/src/librustc_target/spec/fuchsia_base.rs b/src/librustc_target/spec/fuchsia_base.rs index 4e4f2fa0cf34c9178c3dc97794f8471b3af19086..48749dff941ac00cfe15e759160af5d2639cae8b 100644 --- a/src/librustc_target/spec/fuchsia_base.rs +++ b/src/librustc_target/spec/fuchsia_base.rs @@ -19,7 +19,7 @@ pub fn opts() -> TargetOptions { is_like_fuchsia: true, linker_is_gnu: true, has_rpath: false, - pre_link_args: pre_link_args, + pre_link_args, pre_link_objects_exe: vec![ "Scrt1.o".to_string() ], diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 2c3bea80e349b4933529c2fb8ebab1e5e56e74c4..826954ce2168c0a1a91c80c71d7bd00c8fc29d3b 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -461,7 +461,7 @@ impl<'a> Encoder<'a> { /// Creates a new JSON encoder whose output will be written to the writer /// specified. pub fn new(writer: &'a mut dyn fmt::Write) -> Encoder<'a> { - Encoder { writer: writer, is_emitting_map_key: false, } + Encoder { writer, is_emitting_map_key: false, } } } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index f2fac16db01d24b3ad997e9fa254565c9b4f0f3f..c627596bbdf20ea7720e5175660b07787c8f5a09 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1832,7 +1832,7 @@ pub fn from_self(attrs: ThinVec, eself: ExplicitSelf, eself_ident: Id lt, MutTy { ty: infer_ty, - mutbl: mutbl, + mutbl, }, ), span, @@ -2120,7 +2120,7 @@ pub fn new(generic_params: Vec, path: Path, span: Span) -> Self { PolyTraitRef { bound_generic_params: generic_params, trait_ref: TraitRef { - path: path, + path, ref_id: DUMMY_NODE_ID, }, span, diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 9d4bf7d518d75081098ab4bcfb8a2e08c88c6574..baf1031de1e7c40ddbe0f5f84be5bfa792f25ed6 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -815,7 +815,7 @@ fn expr_try(&self, sp: Span, head: P) -> P { fn pat(&self, span: Span, pat: PatKind) -> P { - P(ast::Pat { id: ast::DUMMY_NODE_ID, node: pat, span: span }) + P(ast::Pat { id: ast::DUMMY_NODE_ID, node: pat, span }) } fn pat_wild(&self, span: Span) -> P { self.pat(span, PatKind::Wild) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 945cf36af46fe42788090c0d975da0133fe84880..5473f55aa33704053b03cdf982f7f108fc162a9a 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -231,7 +231,7 @@ pub struct MacroExpander<'a, 'b> { impl<'a, 'b> MacroExpander<'a, 'b> { pub fn new(cx: &'a mut ExtCtxt<'b>, monotonic: bool) -> Self { - MacroExpander { cx: cx, monotonic: monotonic } + MacroExpander { cx, monotonic } } pub fn expand_crate(&mut self, mut krate: ast::Crate) -> ast::Crate { @@ -377,7 +377,7 @@ fn expand_fragment(&mut self, input_fragment: AstFragment) -> AstFragment { _ => item.clone(), }; invocations.push(Invocation { - kind: InvocationKind::Derive { path: path.clone(), item: item }, + kind: InvocationKind::Derive { path: path.clone(), item }, fragment_kind: invoc.fragment_kind, expansion_data: ExpansionData { mark, @@ -944,7 +944,7 @@ fn collect(&mut self, fragment_kind: AstFragmentKind, kind: InvocationKind) -> A } fn collect_bang(&mut self, mac: ast::Mac, span: Span, kind: AstFragmentKind) -> AstFragment { - self.collect(kind, InvocationKind::Bang { mac: mac, ident: None, span: span }) + self.collect(kind, InvocationKind::Bang { mac, ident: None, span }) } fn collect_attr(&mut self, diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index 6f5ce89bc315af8f88c5d67fc1a09378dfbacd36..ccf9db842ab6e467acbe3446d0938916dfeaa341 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -319,7 +319,7 @@ fn parse_tree( tokenstream::TokenTree::Delimited(span, delim, tts) => TokenTree::Delimited( span, Lrc::new(Delimited { - delim: delim, + delim, tts: parse( tts.into(), expect_matchers, diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index c51f4b20c31c04689e7d2f5f68606adf259450f5..ea7f8e356aa63214fbecbf501ec553829d47ec05 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -23,8 +23,8 @@ enum Frame { impl Frame { /// Construct a new frame around the delimited set of tokens. fn new(tts: Vec) -> Frame { - let forest = Lrc::new(quoted::Delimited { delim: token::NoDelim, tts: tts }); - Frame::Delimited { forest: forest, idx: 0, span: DelimSpan::dummy() } + let forest = Lrc::new(quoted::Delimited { delim: token::NoDelim, tts }); + Frame::Delimited { forest, idx: 0, span: DelimSpan::dummy() } } } @@ -248,7 +248,7 @@ pub fn transcribe( // the previous results (from outside the Delimited). quoted::TokenTree::Delimited(mut span, delimited) => { span = span.apply_mark(cx.current_expansion.mark); - stack.push(Frame::Delimited { forest: delimited, idx: 0, span: span }); + stack.push(Frame::Delimited { forest: delimited, idx: 0, span }); result_stack.push(mem::replace(&mut result, Vec::new())); } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index c405acd8ee3f619fd414072d28fba35fc3f9845c..a6e8441a915e0c1464ce6b3acd4952286ff498e8 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1665,7 +1665,7 @@ fn check_attribute( } pub fn check_attribute(attr: &ast::Attribute, parse_sess: &ParseSess, features: &Features) { - let cx = Context { features: features, parse_sess: parse_sess, plugin_attributes: &[] }; + let cx = Context { features, parse_sess, plugin_attributes: &[] }; cx.check_attribute( attr, attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name).map(|a| *a)), diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index a1440f2eba47e237b72601bf7b66c63ee826fa0d..fc206580e3811a79c107d1598c0ef2a775e949eb 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -290,10 +290,10 @@ fn drop(&mut self) { } impl TokenCursorFrame { - fn new(sp: DelimSpan, delim: DelimToken, tts: &TokenStream) -> Self { + fn new(span: DelimSpan, delim: DelimToken, tts: &TokenStream) -> Self { TokenCursorFrame { - delim: delim, - span: sp, + delim, + span, open_delim: delim == token::NoDelim, tree_cursor: tts.clone().into_trees(), close_delim: delim == token::NoDelim, @@ -1449,7 +1449,7 @@ fn parse_borrowed_pointee(&mut self) -> PResult<'a, TyKind> { let opt_lifetime = if self.check_lifetime() { Some(self.expect_lifetime()) } else { None }; let mutbl = self.parse_mutability(); let ty = self.parse_ty_no_plus()?; - return Ok(TyKind::Rptr(opt_lifetime, MutTy { ty: ty, mutbl: mutbl })); + return Ok(TyKind::Rptr(opt_lifetime, MutTy { ty, mutbl })); } fn parse_ptr(&mut self) -> PResult<'a, MutTy> { @@ -1467,7 +1467,7 @@ fn parse_ptr(&mut self) -> PResult<'a, MutTy> { Mutability::Immutable }; let t = self.parse_ty_no_plus()?; - Ok(MutTy { ty: t, mutbl: mutbl }) + Ok(MutTy { ty: t, mutbl }) } fn is_named_argument(&self) -> bool { @@ -4366,7 +4366,7 @@ fn eat_macro_def(&mut self, attrs: &[Attribute], vis: &Visibility, lo: Span) self.report_invalid_macro_expansion_item(); } - (ident, ast::MacroDef { tokens: tokens, legacy: true }) + (ident, ast::MacroDef { tokens, legacy: true }) } _ => return Ok(None), }; @@ -6789,12 +6789,12 @@ fn parse_item_foreign_type(&mut self, vis: ast::Visibility, lo: Span, attrs: Vec let hi = self.token.span; self.expect(&token::Semi)?; Ok(ast::ForeignItem { - ident: ident, - attrs: attrs, + ident, + attrs, node: ForeignItemKind::Ty, id: ast::DUMMY_NODE_ID, span: lo.to(hi), - vis: vis + vis }) } diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs index c0307263387ec6c7e8ec034f33da873f8ad40b8f..ac30cbb471aeab3bf53e948dd37960d4b3a1c241 100644 --- a/src/libsyntax/source_map.rs +++ b/src/libsyntax/source_map.rs @@ -150,7 +150,7 @@ pub fn with_file_loader(file_loader: Box, -> SourceMap { SourceMap { files: Default::default(), - file_loader: file_loader, + file_loader, path_mapping, } } @@ -396,7 +396,7 @@ pub fn lookup_line(&self, pos: BytePos) -> Result Ok(SourceFileAndLine { sf: f, line: line }), + Some(line) => Ok(SourceFileAndLine { sf: f, line }), None => Err(f) } } @@ -511,7 +511,7 @@ pub fn span_to_lines(&self, sp: Span) -> FileLinesResult { start_col, end_col: hi.col }); - Ok(FileLines {file: lo.file, lines: lines}) + Ok(FileLines {file: lo.file, lines}) } /// Extracts the source surrounding the given `Span` using the `extract_source` function. The @@ -820,7 +820,7 @@ pub fn lookup_byte_offset(&self, bpos: BytePos) -> SourceFileAndBytePos { let idx = self.lookup_source_file_idx(bpos); let sf = (*self.files.borrow().source_files)[idx].clone(); let offset = bpos - sf.start_pos; - SourceFileAndBytePos {sf: sf, pos: offset} + SourceFileAndBytePos {sf, pos: offset} } /// Converts an absolute BytePos to a CharPos relative to the source_file.