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
This commit is contained in:
klensy 2024-03-28 12:04:00 +03:00
parent aa35530319
commit 316bc1c67c
9 changed files with 15 additions and 15 deletions

View File

@ -29,7 +29,7 @@ pub struct AsmArgs {
}
fn parse_args<'a>(
ecx: &mut ExtCtxt<'a>,
ecx: &ExtCtxt<'a>,
sp: Span,
tts: TokenStream,
is_global_asm: bool,
@ -303,7 +303,7 @@ pub fn parse_asm_args<'a>(
///
/// This function must be called immediately after the option token is parsed.
/// Otherwise, the suggestion will be incorrect.
fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) {
fn err_duplicate_option(p: &Parser<'_>, symbol: Symbol, span: Span) {
// Tool-only output
let full_span = if p.token.kind == token::Comma { span.to(p.token.span) } else { span };
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) {
/// This function must be called immediately after the option token is parsed.
/// Otherwise, the error will not point to the correct spot.
fn try_set_option<'a>(
p: &mut Parser<'a>,
p: &Parser<'a>,
args: &mut AsmArgs,
symbol: Symbol,
option: ast::InlineAsmOptions,

View File

@ -111,7 +111,7 @@ fn expr_if_not(
cx.expr_if(span, cx.expr(span, ExprKind::Unary(UnOp::Not, cond)), then, els)
}
fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> {
fn parse_assert<'a>(cx: &ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> {
let mut parser = cx.new_parser_from_tts(stream);
if parser.token == token::Eof {

View File

@ -35,7 +35,7 @@ pub fn expand_cfg(
})
}
fn parse_cfg<'a>(cx: &mut ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, ast::MetaItem> {
fn parse_cfg<'a>(cx: &ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, ast::MetaItem> {
let mut p = cx.new_parser_from_tts(tts);
if p.token == token::Eof {

View File

@ -10,7 +10,7 @@ use rustc_span::Span;
pub(crate) struct Expander;
fn validate_input<'a>(ecx: &mut ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> {
fn validate_input<'a>(ecx: &ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> {
use errors::CfgAccessibleInvalid::*;
match mi.meta_item_list() {
None => {}

View File

@ -8,7 +8,7 @@ use crate::errors;
/// Emits errors for literal expressions that are invalid inside and outside of an array.
fn invalid_type_err(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
token_lit: token::Lit,
span: Span,
is_nested: bool,
@ -65,7 +65,7 @@ fn invalid_type_err(
/// Otherwise, returns `None`, and either pushes the `expr`'s span to `missing_literals` or
/// updates `guar` accordingly.
fn handle_array_element(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
guar: &mut Option<ErrorGuaranteed>,
missing_literals: &mut Vec<rustc_span::Span>,
expr: &P<rustc_ast::Expr>,

View File

@ -40,7 +40,7 @@ pub fn expand_unreachable<'cx>(
fn expand<'cx>(
mac: rustc_span::Symbol,
cx: &'cx mut ExtCtxt<'_>,
cx: &'cx ExtCtxt<'_>,
sp: Span,
tts: TokenStream,
) -> MacroExpanderResult<'cx> {

View File

@ -65,7 +65,7 @@ struct MacroInput {
/// ```text
/// Ok((fmtstr, parsed arguments))
/// ```
fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a, MacroInput> {
fn parse_args<'a>(ecx: &ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a, MacroInput> {
let mut args = FormatArguments::new();
let mut p = ecx.new_parser_from_tts(tts);
@ -604,7 +604,7 @@ fn invalid_placeholder_type_error(
}
fn report_missing_placeholders(
ecx: &mut ExtCtxt<'_>,
ecx: &ExtCtxt<'_>,
unused: Vec<(Span, bool)>,
used: &[bool],
args: &FormatArguments,
@ -734,7 +734,7 @@ fn report_missing_placeholders(
/// This function detects and reports unused format!() arguments that are
/// redundant due to implicit captures (e.g. `format!("{x}", x)`).
fn report_redundant_format_arguments<'a>(
ecx: &mut ExtCtxt<'a>,
ecx: &ExtCtxt<'a>,
args: &FormatArguments,
used: &[bool],
placeholders: Vec<(Span, &str)>,
@ -806,7 +806,7 @@ fn report_redundant_format_arguments<'a>(
/// there are named arguments or numbered positional arguments in the
/// format string.
fn report_invalid_references(
ecx: &mut ExtCtxt<'_>,
ecx: &ExtCtxt<'_>,
invalid_refs: &[(usize, Option<Span>, PositionUsedAs, FormatArgPositionKind)],
template: &[FormatArgsPiece],
fmt_span: Span,

View File

@ -234,7 +234,7 @@ pub fn expand_include_bytes(
}
fn load_binary_file(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
original_path: &Path,
macro_span: Span,
path_span: Span,

View File

@ -96,7 +96,7 @@ pub fn expand_bench(
}
pub fn expand_test_or_bench(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
attr_sp: Span,
item: Annotatable,
is_bench: bool,