Skip to content

Commit ee842df

Browse files
committed
Auto merge of #5143 - flip1995:rustup, r=flip1995
Rustup to rust-lang/rust#68788 cc rust-lang/rust#68901 changelog: none
2 parents a6f310e + 9897927 commit ee842df

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

clippy_lints/src/misc_early.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,10 @@ impl EarlyLintPass for MiscEarlyLints {
372372
check_unneeded_wildcard_pattern(cx, pat);
373373
}
374374

375-
fn check_fn(&mut self, cx: &EarlyContext<'_>, _: FnKind<'_>, decl: &FnDecl, _: Span, _: NodeId) {
375+
fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: Span, _: NodeId) {
376376
let mut registered_names: FxHashMap<String, Span> = FxHashMap::default();
377377

378-
for arg in &decl.inputs {
378+
for arg in &fn_kind.decl().inputs {
379379
if let PatKind::Ident(_, ident, None) = arg.pat.kind {
380380
let arg_name = ident.to_string();
381381

clippy_lints/src/non_expressive_names.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
352352

353353
impl EarlyLintPass for NonExpressiveNames {
354354
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
355-
if let ItemKind::Fn(ref sig, _, ref blk) = item.kind {
355+
if let ItemKind::Fn(ref sig, _, Some(ref blk)) = item.kind {
356356
do_check(self, cx, &item.attrs, &sig.decl, blk);
357357
}
358358
}

clippy_lints/src/returns.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,14 @@ impl Return {
235235
}
236236

237237
impl EarlyLintPass for Return {
238-
fn check_fn(&mut self, cx: &EarlyContext<'_>, kind: FnKind<'_>, decl: &ast::FnDecl, span: Span, _: ast::NodeId) {
238+
fn check_fn(&mut self, cx: &EarlyContext<'_>, kind: FnKind<'_>, span: Span, _: ast::NodeId) {
239239
match kind {
240-
FnKind::ItemFn(.., block) | FnKind::Method(.., block) => self.check_block_return(cx, block),
241-
FnKind::Closure(body) => self.check_final_expr(cx, body, Some(body.span), RetReplacement::Empty),
240+
FnKind::Fn(.., Some(block)) => self.check_block_return(cx, block),
241+
FnKind::Closure(_, body) => self.check_final_expr(cx, body, Some(body.span), RetReplacement::Empty),
242+
FnKind::Fn(.., None) => {},
242243
}
243244
if_chain! {
244-
if let ast::FunctionRetTy::Ty(ref ty) = decl.output;
245+
if let ast::FunctionRetTy::Ty(ref ty) = kind.decl().output;
245246
if let ast::TyKind::Tup(ref vals) = ty.kind;
246247
if vals.is_empty() && !ty.span.from_expansion() && get_def(span) == get_def(ty.span);
247248
then {

clippy_lints/src/utils/internal_lints.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -380,18 +380,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OuterExpnDataPass {
380380
declare_lint_pass!(ProduceIce => [PRODUCE_ICE]);
381381

382382
impl EarlyLintPass for ProduceIce {
383-
fn check_fn(&mut self, _: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: &ast::FnDecl, _: Span, _: ast::NodeId) {
383+
fn check_fn(&mut self, _: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: Span, _: ast::NodeId) {
384384
if is_trigger_fn(fn_kind) {
385-
panic!("Testing the ICE message");
385+
panic!("Would you like some help with that?");
386386
}
387387
}
388388
}
389389

390390
fn is_trigger_fn(fn_kind: FnKind<'_>) -> bool {
391391
match fn_kind {
392-
FnKind::ItemFn(ident, ..) | FnKind::Method(ident, ..) => {
393-
ident.name.as_str() == "it_looks_like_you_are_trying_to_kill_clippy"
394-
},
392+
FnKind::Fn(_, ident, ..) => ident.name.as_str() == "it_looks_like_you_are_trying_to_kill_clippy",
395393
FnKind::Closure(..) => false,
396394
}
397395
}

tests/ui/custom_ice_message.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thread 'rustc' panicked at 'Testing the ICE message', clippy_lints/src/utils/internal_lints.rs
1+
thread 'rustc' panicked at 'Would you like some help with that?', clippy_lints/src/utils/internal_lints.rs
22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
33

44
error: internal compiler error: unexpected panic

0 commit comments

Comments
 (0)