Skip to content

Commit 316bc1c

Browse files
committed
compiler: fix few needless_pass_by_ref_mut clippy lints
warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\asm.rs:306:28 | 306 | fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) { | ^^^^^^^^^^^^^^^ help: consider changing to: `&Parser<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\asm.rs:318:8 | 318 | p: &mut Parser<'a>, | ^^^^^^^^^^^^^^^ help: consider changing to: `&Parser<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\assert.rs:114:25 | 114 | fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\asm.rs:32:10 | 32 | ecx: &mut ExtCtxt<'a>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\test.rs:99:9 | 99 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\source_util.rs:237:9 | 237 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\format.rs:809:10 | 809 | ecx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\format.rs:737:10 | 737 | ecx: &mut ExtCtxt<'a>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\format.rs:68:24 | 68 | fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a, MacroInput> { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\format.rs:607:10 | 607 | ecx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\edition_panic.rs:43:9 | 43 | cx: &'cx mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\concat_bytes.rs:11:9 | 11 | cx: &mut ExtCtxt<'_>, | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\cfg.rs:38:22 | 38 | fn parse_cfg<'a>(cx: &mut ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, ast::MetaItem> { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'a>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\cfg_accessible.rs:13:28 | 13 | fn validate_input<'a>(ecx: &mut ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> { | ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
1 parent aa35530 commit 316bc1c

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub struct AsmArgs {
2929
}
3030

3131
fn parse_args<'a>(
32-
ecx: &mut ExtCtxt<'a>,
32+
ecx: &ExtCtxt<'a>,
3333
sp: Span,
3434
tts: TokenStream,
3535
is_global_asm: bool,
@@ -303,7 +303,7 @@ pub fn parse_asm_args<'a>(
303303
///
304304
/// This function must be called immediately after the option token is parsed.
305305
/// Otherwise, the suggestion will be incorrect.
306-
fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) {
306+
fn err_duplicate_option(p: &Parser<'_>, symbol: Symbol, span: Span) {
307307
// Tool-only output
308308
let full_span = if p.token.kind == token::Comma { span.to(p.token.span) } else { span };
309309
p.psess.dcx.emit_err(errors::AsmOptAlreadyprovided { span, symbol, full_span });
@@ -315,7 +315,7 @@ fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) {
315315
/// This function must be called immediately after the option token is parsed.
316316
/// Otherwise, the error will not point to the correct spot.
317317
fn try_set_option<'a>(
318-
p: &mut Parser<'a>,
318+
p: &Parser<'a>,
319319
args: &mut AsmArgs,
320320
symbol: Symbol,
321321
option: ast::InlineAsmOptions,

compiler/rustc_builtin_macros/src/assert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn expr_if_not(
111111
cx.expr_if(span, cx.expr(span, ExprKind::Unary(UnOp::Not, cond)), then, els)
112112
}
113113

114-
fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> {
114+
fn parse_assert<'a>(cx: &ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> {
115115
let mut parser = cx.new_parser_from_tts(stream);
116116

117117
if parser.token == token::Eof {

compiler/rustc_builtin_macros/src/cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn expand_cfg(
3535
})
3636
}
3737

38-
fn parse_cfg<'a>(cx: &mut ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, ast::MetaItem> {
38+
fn parse_cfg<'a>(cx: &ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, ast::MetaItem> {
3939
let mut p = cx.new_parser_from_tts(tts);
4040

4141
if p.token == token::Eof {

compiler/rustc_builtin_macros/src/cfg_accessible.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_span::Span;
1010

1111
pub(crate) struct Expander;
1212

13-
fn validate_input<'a>(ecx: &mut ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> {
13+
fn validate_input<'a>(ecx: &ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> {
1414
use errors::CfgAccessibleInvalid::*;
1515
match mi.meta_item_list() {
1616
None => {}

compiler/rustc_builtin_macros/src/concat_bytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::errors;
88

99
/// Emits errors for literal expressions that are invalid inside and outside of an array.
1010
fn invalid_type_err(
11-
cx: &mut ExtCtxt<'_>,
11+
cx: &ExtCtxt<'_>,
1212
token_lit: token::Lit,
1313
span: Span,
1414
is_nested: bool,
@@ -65,7 +65,7 @@ fn invalid_type_err(
6565
/// Otherwise, returns `None`, and either pushes the `expr`'s span to `missing_literals` or
6666
/// updates `guar` accordingly.
6767
fn handle_array_element(
68-
cx: &mut ExtCtxt<'_>,
68+
cx: &ExtCtxt<'_>,
6969
guar: &mut Option<ErrorGuaranteed>,
7070
missing_literals: &mut Vec<rustc_span::Span>,
7171
expr: &P<rustc_ast::Expr>,

compiler/rustc_builtin_macros/src/edition_panic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn expand_unreachable<'cx>(
4040

4141
fn expand<'cx>(
4242
mac: rustc_span::Symbol,
43-
cx: &'cx mut ExtCtxt<'_>,
43+
cx: &'cx ExtCtxt<'_>,
4444
sp: Span,
4545
tts: TokenStream,
4646
) -> MacroExpanderResult<'cx> {

compiler/rustc_builtin_macros/src/format.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct MacroInput {
6565
/// ```text
6666
/// Ok((fmtstr, parsed arguments))
6767
/// ```
68-
fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a, MacroInput> {
68+
fn parse_args<'a>(ecx: &ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a, MacroInput> {
6969
let mut args = FormatArguments::new();
7070

7171
let mut p = ecx.new_parser_from_tts(tts);
@@ -604,7 +604,7 @@ fn invalid_placeholder_type_error(
604604
}
605605

606606
fn report_missing_placeholders(
607-
ecx: &mut ExtCtxt<'_>,
607+
ecx: &ExtCtxt<'_>,
608608
unused: Vec<(Span, bool)>,
609609
used: &[bool],
610610
args: &FormatArguments,
@@ -734,7 +734,7 @@ fn report_missing_placeholders(
734734
/// This function detects and reports unused format!() arguments that are
735735
/// redundant due to implicit captures (e.g. `format!("{x}", x)`).
736736
fn report_redundant_format_arguments<'a>(
737-
ecx: &mut ExtCtxt<'a>,
737+
ecx: &ExtCtxt<'a>,
738738
args: &FormatArguments,
739739
used: &[bool],
740740
placeholders: Vec<(Span, &str)>,
@@ -806,7 +806,7 @@ fn report_redundant_format_arguments<'a>(
806806
/// there are named arguments or numbered positional arguments in the
807807
/// format string.
808808
fn report_invalid_references(
809-
ecx: &mut ExtCtxt<'_>,
809+
ecx: &ExtCtxt<'_>,
810810
invalid_refs: &[(usize, Option<Span>, PositionUsedAs, FormatArgPositionKind)],
811811
template: &[FormatArgsPiece],
812812
fmt_span: Span,

compiler/rustc_builtin_macros/src/source_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub fn expand_include_bytes(
234234
}
235235

236236
fn load_binary_file(
237-
cx: &mut ExtCtxt<'_>,
237+
cx: &ExtCtxt<'_>,
238238
original_path: &Path,
239239
macro_span: Span,
240240
path_span: Span,

compiler/rustc_builtin_macros/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub fn expand_bench(
9696
}
9797

9898
pub fn expand_test_or_bench(
99-
cx: &mut ExtCtxt<'_>,
99+
cx: &ExtCtxt<'_>,
100100
attr_sp: Span,
101101
item: Annotatable,
102102
is_bench: bool,

0 commit comments

Comments
 (0)