mirror of https://github.com/rust-lang/rust.git
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
This commit is contained in:
parent
ecb39926d8
commit
615bb53a8d
|
@ -157,14 +157,14 @@ fn cs_clone_simple(
|
|||
|
||||
fn cs_clone(
|
||||
name: &str,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
trait_span: Span,
|
||||
substr: &Substructure<'_>,
|
||||
) -> BlockOrExpr {
|
||||
let ctor_path;
|
||||
let all_fields;
|
||||
let fn_path = cx.std_path(&[sym::clone, sym::Clone, sym::clone]);
|
||||
let subcall = |cx: &mut ExtCtxt<'_>, field: &FieldInfo| {
|
||||
let subcall = |cx: &ExtCtxt<'_>, field: &FieldInfo| {
|
||||
let args = thin_vec![field.self_expr.clone()];
|
||||
cx.expr_call_global(field.span, fn_path.clone(), args)
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@ pub fn expand_deriving_ord(
|
|||
trait_def.expand(cx, mitem, item, push)
|
||||
}
|
||||
|
||||
pub fn cs_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
|
||||
pub fn cs_cmp(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
|
||||
let test_id = Ident::new(sym::cmp, span);
|
||||
let equal_path = cx.path_global(span, cx.std_path(&[sym::cmp, sym::Ordering, sym::Equal]));
|
||||
let cmp_path = cx.std_path(&[sym::cmp, sym::Ord, sym::cmp]);
|
||||
|
|
|
@ -16,7 +16,7 @@ pub fn expand_deriving_partial_eq(
|
|||
push: &mut dyn FnMut(Annotatable),
|
||||
is_const: bool,
|
||||
) {
|
||||
fn cs_eq(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
|
||||
fn cs_eq(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
|
||||
let base = true;
|
||||
let expr = cs_fold(
|
||||
true, // use foldl
|
||||
|
|
|
@ -69,7 +69,7 @@ pub fn expand_deriving_partial_ord(
|
|||
}
|
||||
|
||||
fn cs_partial_cmp(
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
span: Span,
|
||||
substr: &Substructure<'_>,
|
||||
tag_then_data: bool,
|
||||
|
|
|
@ -63,7 +63,7 @@ pub fn expand_deriving_rustc_decodable(
|
|||
}
|
||||
|
||||
fn decodable_substructure(
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
trait_span: Span,
|
||||
substr: &Substructure<'_>,
|
||||
krate: Symbol,
|
||||
|
@ -186,14 +186,14 @@ fn decodable_substructure(
|
|||
/// - `outer_pat_path` is the path to this enum variant/struct
|
||||
/// - `getarg` should retrieve the `usize`-th field with name `@str`.
|
||||
fn decode_static_fields<F>(
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
trait_span: Span,
|
||||
outer_pat_path: ast::Path,
|
||||
fields: &StaticFields,
|
||||
mut getarg: F,
|
||||
) -> P<Expr>
|
||||
where
|
||||
F: FnMut(&mut ExtCtxt<'_>, Span, Symbol, usize) -> P<Expr>,
|
||||
F: FnMut(&ExtCtxt<'_>, Span, Symbol, usize) -> P<Expr>,
|
||||
{
|
||||
match fields {
|
||||
Unnamed(fields, is_tuple) => {
|
||||
|
|
|
@ -330,7 +330,7 @@ pub enum SubstructureFields<'a> {
|
|||
/// Combine the values of all the fields together. The last argument is
|
||||
/// all the fields of all the structures.
|
||||
pub type CombineSubstructureFunc<'a> =
|
||||
Box<dyn FnMut(&mut ExtCtxt<'_>, Span, &Substructure<'_>) -> BlockOrExpr + 'a>;
|
||||
Box<dyn FnMut(&ExtCtxt<'_>, Span, &Substructure<'_>) -> BlockOrExpr + 'a>;
|
||||
|
||||
pub fn combine_substructure(
|
||||
f: CombineSubstructureFunc<'_>,
|
||||
|
@ -454,7 +454,7 @@ fn find_type_parameters(
|
|||
impl<'a> TraitDef<'a> {
|
||||
pub fn expand(
|
||||
self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
mitem: &ast::MetaItem,
|
||||
item: &'a Annotatable,
|
||||
push: &mut dyn FnMut(Annotatable),
|
||||
|
@ -464,7 +464,7 @@ impl<'a> TraitDef<'a> {
|
|||
|
||||
pub fn expand_ext(
|
||||
self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
mitem: &ast::MetaItem,
|
||||
item: &'a Annotatable,
|
||||
push: &mut dyn FnMut(Annotatable),
|
||||
|
@ -802,7 +802,7 @@ impl<'a> TraitDef<'a> {
|
|||
|
||||
fn expand_struct_def(
|
||||
&self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
struct_def: &'a VariantData,
|
||||
type_ident: Ident,
|
||||
generics: &Generics,
|
||||
|
@ -856,7 +856,7 @@ impl<'a> TraitDef<'a> {
|
|||
|
||||
fn expand_enum_def(
|
||||
&self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
enum_def: &'a EnumDef,
|
||||
type_ident: Ident,
|
||||
generics: &Generics,
|
||||
|
@ -914,7 +914,7 @@ impl<'a> TraitDef<'a> {
|
|||
impl<'a> MethodDef<'a> {
|
||||
fn call_substructure_method(
|
||||
&self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
trait_: &TraitDef<'_>,
|
||||
type_ident: Ident,
|
||||
nonselflike_args: &[P<Expr>],
|
||||
|
@ -1077,7 +1077,7 @@ impl<'a> MethodDef<'a> {
|
|||
/// ```
|
||||
fn expand_struct_method_body<'b>(
|
||||
&self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
trait_: &TraitDef<'b>,
|
||||
struct_def: &'b VariantData,
|
||||
type_ident: Ident,
|
||||
|
@ -1100,7 +1100,7 @@ impl<'a> MethodDef<'a> {
|
|||
|
||||
fn expand_static_struct_method_body(
|
||||
&self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
trait_: &TraitDef<'_>,
|
||||
struct_def: &VariantData,
|
||||
type_ident: Ident,
|
||||
|
@ -1154,7 +1154,7 @@ impl<'a> MethodDef<'a> {
|
|||
/// `Unify`), and possibly a default arm.
|
||||
fn expand_enum_method_body<'b>(
|
||||
&self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
trait_: &TraitDef<'b>,
|
||||
enum_def: &'b EnumDef,
|
||||
type_ident: Ident,
|
||||
|
@ -1403,7 +1403,7 @@ impl<'a> MethodDef<'a> {
|
|||
|
||||
fn expand_static_enum_method_body(
|
||||
&self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
trait_: &TraitDef<'_>,
|
||||
enum_def: &EnumDef,
|
||||
type_ident: Ident,
|
||||
|
@ -1668,13 +1668,13 @@ pub enum CsFold<'a> {
|
|||
/// Statics may not be folded over.
|
||||
pub fn cs_fold<F>(
|
||||
use_foldl: bool,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
cx: &ExtCtxt<'_>,
|
||||
trait_span: Span,
|
||||
substructure: &Substructure<'_>,
|
||||
mut f: F,
|
||||
) -> P<Expr>
|
||||
where
|
||||
F: FnMut(&mut ExtCtxt<'_>, CsFold<'_>) -> P<Expr>,
|
||||
F: FnMut(&ExtCtxt<'_>, CsFold<'_>) -> P<Expr>,
|
||||
{
|
||||
match substructure.fields {
|
||||
EnumMatching(.., all_fields) | Struct(_, all_fields) => {
|
||||
|
|
Loading…
Reference in New Issue