Skip to content

Commit ecb3992

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\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
1 parent 316bc1c commit ecb3992

File tree

8 files changed

+19
-23
lines changed

8 files changed

+19
-23
lines changed

compiler/rustc_builtin_macros/src/deriving/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub fn expand_deriving_clone(
9494

9595
fn cs_clone_simple(
9696
name: &str,
97-
cx: &mut ExtCtxt<'_>,
97+
cx: &ExtCtxt<'_>,
9898
trait_span: Span,
9999
substr: &Substructure<'_>,
100100
is_union: bool,

compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn expand_deriving_eq(
4949
}
5050

5151
fn cs_total_eq_assert(
52-
cx: &mut ExtCtxt<'_>,
52+
cx: &ExtCtxt<'_>,
5353
trait_span: Span,
5454
substr: &Substructure<'_>,
5555
) -> BlockOrExpr {

compiler/rustc_builtin_macros/src/deriving/debug.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn expand_deriving_debug(
4545
trait_def.expand(cx, mitem, item, push)
4646
}
4747

48-
fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
48+
fn show_substructure(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
4949
// We want to make sure we have the ctxt set so that we can use unstable methods
5050
let span = cx.with_def_site_ctxt(span);
5151

@@ -209,7 +209,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
209209
/// }
210210
/// ```
211211
fn show_fieldless_enum(
212-
cx: &mut ExtCtxt<'_>,
212+
cx: &ExtCtxt<'_>,
213213
span: Span,
214214
def: &EnumDef,
215215
substr: &Substructure<'_>,

compiler/rustc_builtin_macros/src/deriving/default.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub fn expand_deriving_default(
5454
}
5555

5656
fn default_struct_substructure(
57-
cx: &mut ExtCtxt<'_>,
57+
cx: &ExtCtxt<'_>,
5858
trait_span: Span,
5959
substr: &Substructure<'_>,
6060
summary: &StaticFields,
@@ -81,7 +81,7 @@ fn default_struct_substructure(
8181
}
8282

8383
fn default_enum_substructure(
84-
cx: &mut ExtCtxt<'_>,
84+
cx: &ExtCtxt<'_>,
8585
trait_span: Span,
8686
enum_def: &EnumDef,
8787
) -> BlockOrExpr {
@@ -103,7 +103,7 @@ fn default_enum_substructure(
103103
}
104104

105105
fn extract_default_variant<'a>(
106-
cx: &mut ExtCtxt<'_>,
106+
cx: &ExtCtxt<'_>,
107107
enum_def: &'a EnumDef,
108108
trait_span: Span,
109109
) -> Result<&'a rustc_ast::Variant, ErrorGuaranteed> {
@@ -173,7 +173,7 @@ fn extract_default_variant<'a>(
173173
}
174174

175175
fn validate_default_attribute(
176-
cx: &mut ExtCtxt<'_>,
176+
cx: &ExtCtxt<'_>,
177177
default_variant: &rustc_ast::Variant,
178178
) -> Result<(), ErrorGuaranteed> {
179179
let attrs: SmallVec<[_; 1]> =

compiler/rustc_builtin_macros/src/deriving/encodable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub fn expand_deriving_rustc_encodable(
147147
}
148148

149149
fn encodable_substructure(
150-
cx: &mut ExtCtxt<'_>,
150+
cx: &ExtCtxt<'_>,
151151
trait_span: Span,
152152
substr: &Substructure<'_>,
153153
krate: Symbol,

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ impl<'a> TraitDef<'a> {
577577
/// therefore does not get bound by the derived trait.
578578
fn create_derived_impl(
579579
&self,
580-
cx: &mut ExtCtxt<'_>,
580+
cx: &ExtCtxt<'_>,
581581
type_ident: Ident,
582582
generics: &Generics,
583583
field_tys: Vec<P<ast::Ty>>,
@@ -929,7 +929,7 @@ impl<'a> MethodDef<'a> {
929929

930930
fn get_ret_ty(
931931
&self,
932-
cx: &mut ExtCtxt<'_>,
932+
cx: &ExtCtxt<'_>,
933933
trait_: &TraitDef<'_>,
934934
generics: &Generics,
935935
type_ident: Ident,
@@ -950,7 +950,7 @@ impl<'a> MethodDef<'a> {
950950
// `&self`.
951951
fn extract_arg_details(
952952
&self,
953-
cx: &mut ExtCtxt<'_>,
953+
cx: &ExtCtxt<'_>,
954954
trait_: &TraitDef<'_>,
955955
type_ident: Ident,
956956
generics: &Generics,
@@ -986,7 +986,7 @@ impl<'a> MethodDef<'a> {
986986

987987
fn create_method(
988988
&self,
989-
cx: &mut ExtCtxt<'_>,
989+
cx: &ExtCtxt<'_>,
990990
trait_: &TraitDef<'_>,
991991
type_ident: Ident,
992992
generics: &Generics,
@@ -1430,7 +1430,7 @@ impl<'a> MethodDef<'a> {
14301430

14311431
// general helper methods.
14321432
impl<'a> TraitDef<'a> {
1433-
fn summarise_struct(&self, cx: &mut ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields {
1433+
fn summarise_struct(&self, cx: &ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields {
14341434
let mut named_idents = Vec::new();
14351435
let mut just_spans = Vec::new();
14361436
for field in struct_def.fields() {
@@ -1460,7 +1460,7 @@ impl<'a> TraitDef<'a> {
14601460

14611461
fn create_struct_patterns(
14621462
&self,
1463-
cx: &mut ExtCtxt<'_>,
1463+
cx: &ExtCtxt<'_>,
14641464
struct_path: ast::Path,
14651465
struct_def: &'a VariantData,
14661466
prefixes: &[String],
@@ -1553,7 +1553,7 @@ impl<'a> TraitDef<'a> {
15531553

15541554
fn create_struct_pattern_fields(
15551555
&self,
1556-
cx: &mut ExtCtxt<'_>,
1556+
cx: &ExtCtxt<'_>,
15571557
struct_def: &'a VariantData,
15581558
prefixes: &[String],
15591559
) -> Vec<FieldInfo> {
@@ -1570,7 +1570,7 @@ impl<'a> TraitDef<'a> {
15701570

15711571
fn create_struct_field_access_fields(
15721572
&self,
1573-
cx: &mut ExtCtxt<'_>,
1573+
cx: &ExtCtxt<'_>,
15741574
selflike_args: &[P<Expr>],
15751575
struct_def: &'a VariantData,
15761576
is_packed: bool,

compiler/rustc_builtin_macros/src/deriving/hash.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ pub fn expand_deriving_hash(
4646
hash_trait_def.expand(cx, mitem, item, push);
4747
}
4848

49-
fn hash_substructure(
50-
cx: &mut ExtCtxt<'_>,
51-
trait_span: Span,
52-
substr: &Substructure<'_>,
53-
) -> BlockOrExpr {
49+
fn hash_substructure(cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
5450
let [state_expr] = substr.nonselflike_args else {
5551
cx.dcx().span_bug(trait_span, "incorrect number of arguments in `derive(Hash)`");
5652
};

compiler/rustc_builtin_macros/src/deriving/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn call_unreachable(cx: &ExtCtxt<'_>, span: Span) -> P<ast::Expr> {
117117
}
118118

119119
fn assert_ty_bounds(
120-
cx: &mut ExtCtxt<'_>,
120+
cx: &ExtCtxt<'_>,
121121
stmts: &mut ThinVec<ast::Stmt>,
122122
ty: P<ast::Ty>,
123123
span: Span,

0 commit comments

Comments
 (0)