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\deriving\mod.rs:120:9
    |
120 |     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\deriving\generic\mod.rs:1573:13
     |
1573 |         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\deriving\generic\mod.rs:1556:13
     |
1556 |         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\deriving\generic\mod.rs:1463:13
     |
1463 |         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\deriving\generic\mod.rs:1433:36
     |
1433 |     fn summarise_struct(&self, cx: &mut ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields {
     |                                    ^^^^^^^^^^^^^^^^ 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\deriving\generic\mod.rs:953:13
    |
953 |         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\deriving\generic\mod.rs:932:13
    |
932 |         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\deriving\generic\mod.rs:580:13
    |
580 |         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\deriving\generic\mod.rs:989:13
    |
989 |         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\deriving\clone.rs:97:9
   |
97 |     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\deriving\cmp\eq.rs:52:9
   |
52 |     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\deriving\hash.rs:50:9
   |
50 |     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\deriving\encodable.rs:150:9
    |
150 |     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\deriving\default.rs:176:9
    |
176 |     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\deriving\default.rs:106:9
    |
106 |     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\deriving\default.rs:57:9
   |
57 |     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\deriving\default.rs:84:9
   |
84 |     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\deriving\debug.rs:212:9
    |
212 |     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\deriving\debug.rs:48:26
   |
48 | fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
   |                          ^^^^^^^^^^^^^^^^ 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:16:08 +03:00
parent 316bc1c67c
commit ecb39926d8
8 changed files with 19 additions and 23 deletions

View file

@ -94,7 +94,7 @@ pub fn expand_deriving_clone(
fn cs_clone_simple(
name: &str,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
is_union: bool,

View file

@ -49,7 +49,7 @@ pub fn expand_deriving_eq(
}
fn cs_total_eq_assert(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
) -> BlockOrExpr {

View file

@ -45,7 +45,7 @@ pub fn expand_deriving_debug(
trait_def.expand(cx, mitem, item, push)
}
fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
fn show_substructure(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
// We want to make sure we have the ctxt set so that we can use unstable methods
let span = cx.with_def_site_ctxt(span);
@ -209,7 +209,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
/// }
/// ```
fn show_fieldless_enum(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
span: Span,
def: &EnumDef,
substr: &Substructure<'_>,

View file

@ -54,7 +54,7 @@ pub fn expand_deriving_default(
}
fn default_struct_substructure(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
summary: &StaticFields,
@ -81,7 +81,7 @@ fn default_struct_substructure(
}
fn default_enum_substructure(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
enum_def: &EnumDef,
) -> BlockOrExpr {
@ -103,7 +103,7 @@ fn default_enum_substructure(
}
fn extract_default_variant<'a>(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
enum_def: &'a EnumDef,
trait_span: Span,
) -> Result<&'a rustc_ast::Variant, ErrorGuaranteed> {
@ -173,7 +173,7 @@ fn extract_default_variant<'a>(
}
fn validate_default_attribute(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
default_variant: &rustc_ast::Variant,
) -> Result<(), ErrorGuaranteed> {
let attrs: SmallVec<[_; 1]> =

View file

@ -147,7 +147,7 @@ pub fn expand_deriving_rustc_encodable(
}
fn encodable_substructure(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
krate: Symbol,

View file

@ -577,7 +577,7 @@ impl<'a> TraitDef<'a> {
/// therefore does not get bound by the derived trait.
fn create_derived_impl(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
type_ident: Ident,
generics: &Generics,
field_tys: Vec<P<ast::Ty>>,
@ -929,7 +929,7 @@ impl<'a> MethodDef<'a> {
fn get_ret_ty(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_: &TraitDef<'_>,
generics: &Generics,
type_ident: Ident,
@ -950,7 +950,7 @@ impl<'a> MethodDef<'a> {
// `&self`.
fn extract_arg_details(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_: &TraitDef<'_>,
type_ident: Ident,
generics: &Generics,
@ -986,7 +986,7 @@ impl<'a> MethodDef<'a> {
fn create_method(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_: &TraitDef<'_>,
type_ident: Ident,
generics: &Generics,
@ -1430,7 +1430,7 @@ impl<'a> MethodDef<'a> {
// general helper methods.
impl<'a> TraitDef<'a> {
fn summarise_struct(&self, cx: &mut ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields {
fn summarise_struct(&self, cx: &ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields {
let mut named_idents = Vec::new();
let mut just_spans = Vec::new();
for field in struct_def.fields() {
@ -1460,7 +1460,7 @@ impl<'a> TraitDef<'a> {
fn create_struct_patterns(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
struct_path: ast::Path,
struct_def: &'a VariantData,
prefixes: &[String],
@ -1553,7 +1553,7 @@ impl<'a> TraitDef<'a> {
fn create_struct_pattern_fields(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
struct_def: &'a VariantData,
prefixes: &[String],
) -> Vec<FieldInfo> {
@ -1570,7 +1570,7 @@ impl<'a> TraitDef<'a> {
fn create_struct_field_access_fields(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
selflike_args: &[P<Expr>],
struct_def: &'a VariantData,
is_packed: bool,

View file

@ -46,11 +46,7 @@ pub fn expand_deriving_hash(
hash_trait_def.expand(cx, mitem, item, push);
}
fn hash_substructure(
cx: &mut ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
) -> BlockOrExpr {
fn hash_substructure(cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
let [state_expr] = substr.nonselflike_args else {
cx.dcx().span_bug(trait_span, "incorrect number of arguments in `derive(Hash)`");
};

View file

@ -117,7 +117,7 @@ fn call_unreachable(cx: &ExtCtxt<'_>, span: Span) -> P<ast::Expr> {
}
fn assert_ty_bounds(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
stmts: &mut ThinVec<ast::Stmt>,
ty: P<ast::Ty>,
span: Span,