Skip to content

Commit f6c752b

Browse files
committed
Auto merge of #4462 - JohnTitor:fix-build-arg, r=flip1995
Replace `Arg` with `Param` Fix build issue. Rustup to rust-lang/rust#63127 changelog: none
2 parents 949b347 + 2c28225 commit f6c752b

12 files changed

+25
-19
lines changed

clippy_lints/src/bytecount.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
4747
then {
4848
let body = cx.tcx.hir().body(body_id);
4949
if_chain! {
50-
if body.arguments.len() == 1;
51-
if let Some(argname) = get_pat_name(&body.arguments[0].pat);
50+
if body.params.len() == 1;
51+
if let Some(argname) = get_pat_name(&body.params[0].pat);
5252
if let ExprKind::Binary(ref op, ref l, ref r) = body.value.node;
5353
if op.node == BinOpKind::Eq;
5454
if match_type(cx,

clippy_lints/src/escape.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn is_argument(map: &hir::map::Map<'_>, id: HirId) -> bool {
108108
}
109109

110110
match map.find(map.get_parent_node(id)) {
111-
Some(Node::Arg(_)) => true,
111+
Some(Node::Param(_)) => true,
112112
_ => false,
113113
}
114114
}

clippy_lints/src/eta_reduction.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,10 @@ fn get_type_name(cx: &LateContext<'_, '_>, ty: Ty<'_>) -> String {
202202
}
203203
}
204204

205-
fn compare_inputs(closure_inputs: &mut dyn Iterator<Item = &Arg>, call_args: &mut dyn Iterator<Item = &Expr>) -> bool {
205+
fn compare_inputs(
206+
closure_inputs: &mut dyn Iterator<Item = &Param>,
207+
call_args: &mut dyn Iterator<Item = &Expr>,
208+
) -> bool {
206209
for (closure_input, function_arg) in closure_inputs.zip(call_args) {
207210
if let PatKind::Binding(_, _, ident, _) = closure_input.pat.node {
208211
// XXXManishearth Should I be checking the binding mode here?

clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'a, 'tcx> Functions {
280280
}
281281
}
282282

283-
fn raw_ptr_arg(arg: &hir::Arg, ty: &hir::Ty) -> Option<hir::HirId> {
283+
fn raw_ptr_arg(arg: &hir::Param, ty: &hir::Ty) -> Option<hir::HirId> {
284284
if let (&hir::PatKind::Binding(_, id, _, _), &hir::TyKind::Ptr(_)) = (&arg.pat.node, &ty.node) {
285285
Some(id)
286286
} else {

clippy_lints/src/map_clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MapClone {
5757
let closure_body = cx.tcx.hir().body(body_id);
5858
let closure_expr = remove_blocks(&closure_body.value);
5959
then {
60-
match closure_body.arguments[0].pat.node {
60+
match closure_body.params[0].pat.node {
6161
hir::PatKind::Ref(ref inner, _) => if let hir::PatKind::Binding(
6262
hir::BindingAnnotation::Unannotated, .., name, None
6363
) = inner.node {

clippy_lints/src/map_unit_fn.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ fn reduce_unit_expression<'a>(cx: &LateContext<'_, '_>, expr: &'a hir::Expr) ->
161161
}
162162
}
163163

164-
fn unit_closure<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'a hir::Expr) -> Option<(&'tcx hir::Arg, &'a hir::Expr)> {
164+
fn unit_closure<'a, 'tcx>(
165+
cx: &LateContext<'a, 'tcx>,
166+
expr: &'a hir::Expr,
167+
) -> Option<(&'tcx hir::Param, &'a hir::Expr)> {
165168
if let hir::ExprKind::Closure(_, ref decl, inner_expr_id, _, _) = expr.node {
166169
let body = cx.tcx.hir().body(inner_expr_id);
167170
let body_expr = &body.value;

clippy_lints/src/methods/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1732,8 +1732,8 @@ fn lint_unnecessary_fold(cx: &LateContext<'_, '_>, expr: &hir::Expr, fold_args:
17321732
if bin_op.node == op;
17331733

17341734
// Extract the names of the two arguments to the closure
1735-
if let Some(first_arg_ident) = get_arg_name(&closure_body.arguments[0].pat);
1736-
if let Some(second_arg_ident) = get_arg_name(&closure_body.arguments[1].pat);
1735+
if let Some(first_arg_ident) = get_arg_name(&closure_body.params[0].pat);
1736+
if let Some(second_arg_ident) = get_arg_name(&closure_body.params[1].pat);
17371737

17381738
if match_var(&*left_expr, first_arg_ident);
17391739
if replacement_has_args || match_var(&*right_expr, second_arg_ident);
@@ -2345,7 +2345,7 @@ fn lint_flat_map_identity<'a, 'tcx>(
23452345
if let hir::ExprKind::Closure(_, _, body_id, _, _) = arg_node;
23462346
let body = cx.tcx.hir().body(*body_id);
23472347

2348-
if let hir::PatKind::Binding(_, _, binding_ident, _) = body.arguments[0].pat.node;
2348+
if let hir::PatKind::Binding(_, _, binding_ident, _) = body.params[0].pat.node;
23492349
if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = body.value.node;
23502350

23512351
if path.segments.len() == 1;
@@ -2390,7 +2390,7 @@ fn lint_search_is_some<'a, 'tcx>(
23902390
if search_method == "find";
23912391
if let hir::ExprKind::Closure(_, _, body_id, ..) = search_args[1].node;
23922392
let closure_body = cx.tcx.hir().body(body_id);
2393-
if let Some(closure_arg) = closure_body.arguments.get(0);
2393+
if let Some(closure_arg) = closure_body.params.get(0);
23942394
if let hir::PatKind::Ref(..) = closure_arg.pat.node;
23952395
then {
23962396
Some(search_snippet.replacen('&', "", 1))

clippy_lints/src/methods/unnecessary_filter_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn lint(cx: &LateContext<'_, '_>, expr: &hir::Expr, args: &[hir::Expr
1717

1818
if let hir::ExprKind::Closure(_, _, body_id, ..) = args[1].node {
1919
let body = cx.tcx.hir().body(body_id);
20-
let arg_id = body.arguments[0].pat.hir_id;
20+
let arg_id = body.params[0].pat.hir_id;
2121
let mutates_arg = match mutated_variables(&body.value, cx) {
2222
Some(used_mutably) => used_mutably.contains(&arg_id),
2323
None => true,

clippy_lints/src/needless_pass_by_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
152152
let fn_sig = cx.tcx.fn_sig(fn_def_id);
153153
let fn_sig = cx.tcx.erase_late_bound_regions(&fn_sig);
154154

155-
for (idx, ((input, &ty), arg)) in decl.inputs.iter().zip(fn_sig.inputs()).zip(&body.arguments).enumerate() {
155+
for (idx, ((input, &ty), arg)) in decl.inputs.iter().zip(fn_sig.inputs()).zip(&body.params).enumerate() {
156156
// All spans generated from a proc-macro invocation are the same...
157157
if span == input.span {
158158
return;

clippy_lints/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher {
20562056
continue;
20572057
}
20582058
let generics_suggestion_span = generics.span.substitute_dummy({
2059-
let pos = snippet_opt(cx, item.span.until(body.arguments[0].pat.span))
2059+
let pos = snippet_opt(cx, item.span.until(body.params[0].pat.span))
20602060
.and_then(|snip| {
20612061
let i = snip.find("fn")?;
20622062
Some(item.span.lo() + BytePos((i + (&snip[i..]).find('(')?) as u32))

clippy_lints/src/utils/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ pub fn remove_blocks(expr: &Expr) -> &Expr {
835835
}
836836
}
837837

838-
pub fn is_self(slf: &Arg) -> bool {
838+
pub fn is_self(slf: &Param) -> bool {
839839
if let PatKind::Binding(.., name, _) = slf.pat.node {
840840
name.name == kw::SelfLower
841841
} else {
@@ -855,8 +855,8 @@ pub fn is_self_ty(slf: &hir::Ty) -> bool {
855855
false
856856
}
857857

858-
pub fn iter_input_pats<'tcx>(decl: &FnDecl, body: &'tcx Body) -> impl Iterator<Item = &'tcx Arg> {
859-
(0..decl.inputs.len()).map(move |i| &body.arguments[i])
858+
pub fn iter_input_pats<'tcx>(decl: &FnDecl, body: &'tcx Body) -> impl Iterator<Item = &'tcx Param> {
859+
(0..decl.inputs.len()).map(move |i| &body.params[i])
860860
}
861861

862862
/// Checks if a given expression is a match expression expanded from the `?`

clippy_lints/src/utils/ptr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn get_spans(
1313
replacements: &[(&'static str, &'static str)],
1414
) -> Option<Vec<(Span, Cow<'static, str>)>> {
1515
if let Some(body) = opt_body_id.map(|id| cx.tcx.hir().body(id)) {
16-
get_binding_name(&body.arguments[idx]).map_or_else(
16+
get_binding_name(&body.params[idx]).map_or_else(
1717
|| Some(vec![]),
1818
|name| extract_clone_suggestions(cx, name, replacements, body),
1919
)
@@ -80,6 +80,6 @@ impl<'a, 'tcx> Visitor<'tcx> for PtrCloneVisitor<'a, 'tcx> {
8080
}
8181
}
8282

83-
fn get_binding_name(arg: &Arg) -> Option<Name> {
83+
fn get_binding_name(arg: &Param) -> Option<Name> {
8484
get_pat_name(&arg.pat)
8585
}

0 commit comments

Comments
 (0)