Skip to content

Commit 615bb53

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\clone.rs:160:9 | 160 | 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\partial_ord.rs:72:9 | 72 | 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\partial_eq.rs:19:18 | 19 | fn cs_eq(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 warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\cmp\ord.rs:42:19 | 42 | pub fn cs_cmp(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 warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:917:13 | 917 | 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:1406:13 | 1406 | 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:1157:13 | 1157 | 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:1103:13 | 1103 | 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:1080:13 | 1080 | 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:859:13 | 859 | 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:805:13 | 805 | 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:467:13 | 467 | 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:457:13 | 457 | 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
1 parent ecb3992 commit 615bb53

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

compiler/rustc_builtin_macros/src/deriving/clone.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,14 @@ fn cs_clone_simple(
157157

158158
fn cs_clone(
159159
name: &str,
160-
cx: &mut ExtCtxt<'_>,
160+
cx: &ExtCtxt<'_>,
161161
trait_span: Span,
162162
substr: &Substructure<'_>,
163163
) -> BlockOrExpr {
164164
let ctor_path;
165165
let all_fields;
166166
let fn_path = cx.std_path(&[sym::clone, sym::Clone, sym::clone]);
167-
let subcall = |cx: &mut ExtCtxt<'_>, field: &FieldInfo| {
167+
let subcall = |cx: &ExtCtxt<'_>, field: &FieldInfo| {
168168
let args = thin_vec![field.self_expr.clone()];
169169
cx.expr_call_global(field.span, fn_path.clone(), args)
170170
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn expand_deriving_ord(
3939
trait_def.expand(cx, mitem, item, push)
4040
}
4141

42-
pub fn cs_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
42+
pub fn cs_cmp(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
4343
let test_id = Ident::new(sym::cmp, span);
4444
let equal_path = cx.path_global(span, cx.std_path(&[sym::cmp, sym::Ordering, sym::Equal]));
4545
let cmp_path = cx.std_path(&[sym::cmp, sym::Ord, sym::cmp]);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn expand_deriving_partial_eq(
1616
push: &mut dyn FnMut(Annotatable),
1717
is_const: bool,
1818
) {
19-
fn cs_eq(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
19+
fn cs_eq(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
2020
let base = true;
2121
let expr = cs_fold(
2222
true, // use foldl

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn expand_deriving_partial_ord(
6969
}
7070

7171
fn cs_partial_cmp(
72-
cx: &mut ExtCtxt<'_>,
72+
cx: &ExtCtxt<'_>,
7373
span: Span,
7474
substr: &Substructure<'_>,
7575
tag_then_data: bool,

compiler/rustc_builtin_macros/src/deriving/decodable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn expand_deriving_rustc_decodable(
6363
}
6464

6565
fn decodable_substructure(
66-
cx: &mut ExtCtxt<'_>,
66+
cx: &ExtCtxt<'_>,
6767
trait_span: Span,
6868
substr: &Substructure<'_>,
6969
krate: Symbol,
@@ -186,14 +186,14 @@ fn decodable_substructure(
186186
/// - `outer_pat_path` is the path to this enum variant/struct
187187
/// - `getarg` should retrieve the `usize`-th field with name `@str`.
188188
fn decode_static_fields<F>(
189-
cx: &mut ExtCtxt<'_>,
189+
cx: &ExtCtxt<'_>,
190190
trait_span: Span,
191191
outer_pat_path: ast::Path,
192192
fields: &StaticFields,
193193
mut getarg: F,
194194
) -> P<Expr>
195195
where
196-
F: FnMut(&mut ExtCtxt<'_>, Span, Symbol, usize) -> P<Expr>,
196+
F: FnMut(&ExtCtxt<'_>, Span, Symbol, usize) -> P<Expr>,
197197
{
198198
match fields {
199199
Unnamed(fields, is_tuple) => {

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ pub enum SubstructureFields<'a> {
330330
/// Combine the values of all the fields together. The last argument is
331331
/// all the fields of all the structures.
332332
pub type CombineSubstructureFunc<'a> =
333-
Box<dyn FnMut(&mut ExtCtxt<'_>, Span, &Substructure<'_>) -> BlockOrExpr + 'a>;
333+
Box<dyn FnMut(&ExtCtxt<'_>, Span, &Substructure<'_>) -> BlockOrExpr + 'a>;
334334

335335
pub fn combine_substructure(
336336
f: CombineSubstructureFunc<'_>,
@@ -454,7 +454,7 @@ fn find_type_parameters(
454454
impl<'a> TraitDef<'a> {
455455
pub fn expand(
456456
self,
457-
cx: &mut ExtCtxt<'_>,
457+
cx: &ExtCtxt<'_>,
458458
mitem: &ast::MetaItem,
459459
item: &'a Annotatable,
460460
push: &mut dyn FnMut(Annotatable),
@@ -464,7 +464,7 @@ impl<'a> TraitDef<'a> {
464464

465465
pub fn expand_ext(
466466
self,
467-
cx: &mut ExtCtxt<'_>,
467+
cx: &ExtCtxt<'_>,
468468
mitem: &ast::MetaItem,
469469
item: &'a Annotatable,
470470
push: &mut dyn FnMut(Annotatable),
@@ -802,7 +802,7 @@ impl<'a> TraitDef<'a> {
802802

803803
fn expand_struct_def(
804804
&self,
805-
cx: &mut ExtCtxt<'_>,
805+
cx: &ExtCtxt<'_>,
806806
struct_def: &'a VariantData,
807807
type_ident: Ident,
808808
generics: &Generics,
@@ -856,7 +856,7 @@ impl<'a> TraitDef<'a> {
856856

857857
fn expand_enum_def(
858858
&self,
859-
cx: &mut ExtCtxt<'_>,
859+
cx: &ExtCtxt<'_>,
860860
enum_def: &'a EnumDef,
861861
type_ident: Ident,
862862
generics: &Generics,
@@ -914,7 +914,7 @@ impl<'a> TraitDef<'a> {
914914
impl<'a> MethodDef<'a> {
915915
fn call_substructure_method(
916916
&self,
917-
cx: &mut ExtCtxt<'_>,
917+
cx: &ExtCtxt<'_>,
918918
trait_: &TraitDef<'_>,
919919
type_ident: Ident,
920920
nonselflike_args: &[P<Expr>],
@@ -1077,7 +1077,7 @@ impl<'a> MethodDef<'a> {
10771077
/// ```
10781078
fn expand_struct_method_body<'b>(
10791079
&self,
1080-
cx: &mut ExtCtxt<'_>,
1080+
cx: &ExtCtxt<'_>,
10811081
trait_: &TraitDef<'b>,
10821082
struct_def: &'b VariantData,
10831083
type_ident: Ident,
@@ -1100,7 +1100,7 @@ impl<'a> MethodDef<'a> {
11001100

11011101
fn expand_static_struct_method_body(
11021102
&self,
1103-
cx: &mut ExtCtxt<'_>,
1103+
cx: &ExtCtxt<'_>,
11041104
trait_: &TraitDef<'_>,
11051105
struct_def: &VariantData,
11061106
type_ident: Ident,
@@ -1154,7 +1154,7 @@ impl<'a> MethodDef<'a> {
11541154
/// `Unify`), and possibly a default arm.
11551155
fn expand_enum_method_body<'b>(
11561156
&self,
1157-
cx: &mut ExtCtxt<'_>,
1157+
cx: &ExtCtxt<'_>,
11581158
trait_: &TraitDef<'b>,
11591159
enum_def: &'b EnumDef,
11601160
type_ident: Ident,
@@ -1403,7 +1403,7 @@ impl<'a> MethodDef<'a> {
14031403

14041404
fn expand_static_enum_method_body(
14051405
&self,
1406-
cx: &mut ExtCtxt<'_>,
1406+
cx: &ExtCtxt<'_>,
14071407
trait_: &TraitDef<'_>,
14081408
enum_def: &EnumDef,
14091409
type_ident: Ident,
@@ -1668,13 +1668,13 @@ pub enum CsFold<'a> {
16681668
/// Statics may not be folded over.
16691669
pub fn cs_fold<F>(
16701670
use_foldl: bool,
1671-
cx: &mut ExtCtxt<'_>,
1671+
cx: &ExtCtxt<'_>,
16721672
trait_span: Span,
16731673
substructure: &Substructure<'_>,
16741674
mut f: F,
16751675
) -> P<Expr>
16761676
where
1677-
F: FnMut(&mut ExtCtxt<'_>, CsFold<'_>) -> P<Expr>,
1677+
F: FnMut(&ExtCtxt<'_>, CsFold<'_>) -> P<Expr>,
16781678
{
16791679
match substructure.fields {
16801680
EnumMatching(.., all_fields) | Struct(_, all_fields) => {

0 commit comments

Comments
 (0)