From 8661abd6a39f76b11b9c2fd60a22f936049221b6 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Thu, 11 Jan 2024 03:08:40 +0000 Subject: [PATCH] Account for API changes --- .../derive_opportunity/src/lib.rs | 5 ++++- .../missing_doc_comment_openai/src/lib.rs | 6 +++--- .../missing_doc_comment_openai/ui/main.stderr | 2 +- .../await_holding_span_guard/src/lib.rs | 19 +++++++++++++------ .../general/crate_wide_allow/ui/main.stderr | 2 +- .../src/lib.rs | 2 +- .../src/visit_error_paths.rs | 2 +- .../non_thread_safe_call_in_test/src/late.rs | 2 +- .../src/pre_expansion.rs | 2 +- .../ui_late/interprocedural.stderr | 2 +- .../ui_late/set_current_dir.stderr | 2 +- .../inconsistent_qualification/src/lib.rs | 6 +++--- .../misleading_variable_name/src/lib.rs | 2 +- .../restriction/overscoped_allow/src/lib.rs | 7 ++++--- .../overscoped_allow/ui_test/main.stderr | 2 +- .../question_mark_in_expression/src/lib.rs | 2 +- .../ui/clone.stderr | 2 +- .../question_mark_in_expression/ui/ls.stderr | 2 +- .../ui/non-empty.stderr | 2 +- .../ui/eta.stderr | 2 +- examples/restriction/try_io_result/src/lib.rs | 2 +- .../restriction/try_io_result/ui/main.stderr | 2 +- .../redundant_reference/src/lib.rs | 5 ++--- .../redundant_reference/ui/main.stderr | 2 +- .../ui_no_lifetime_check/main.stderr | 2 +- .../src/check_inherents.rs | 4 ++-- .../src/lib.rs | 3 +++ .../ui/vec.stderr | 2 +- 28 files changed, 54 insertions(+), 41 deletions(-) diff --git a/examples/experimental/derive_opportunity/src/lib.rs b/examples/experimental/derive_opportunity/src/lib.rs index 895d22fb6..daf6a3df3 100644 --- a/examples/experimental/derive_opportunity/src/lib.rs +++ b/examples/experimental/derive_opportunity/src/lib.rs @@ -360,7 +360,10 @@ fn implements_trait_with_bounds<'tcx>( ]; if let ty::Adt(adt_def, _) = ty.kind() { let param_env = param_env_with_bounds(cx.tcx, adt_def.did(), trait_id); - implements_trait_with_env(cx.tcx, param_env, ty, trait_id, &args) + // smoelius: I am not sure that `adt_def.did()` is the right thing to pass for the + // `callee_id` argument. This choice is based on: + // https://github.com/rust-lang/rust-clippy/blob/782520088f9c5a0274459060a6fdcd41301f35e2/clippy_lints/src/derive.rs#L453 + implements_trait_with_env(cx.tcx, param_env, ty, trait_id, adt_def.did(), &args) } else { implements_trait(cx, ty, trait_id, &args) } diff --git a/examples/experimental/missing_doc_comment_openai/src/lib.rs b/examples/experimental/missing_doc_comment_openai/src/lib.rs index c36fb9482..99b5bee67 100644 --- a/examples/experimental/missing_doc_comment_openai/src/lib.rs +++ b/examples/experimental/missing_doc_comment_openai/src/lib.rs @@ -131,7 +131,7 @@ impl MissingDocCommentOpenai { impl<'tcx> LateLintPass<'tcx> for MissingDocCommentOpenai { fn check_crate(&mut self, cx: &LateContext<'tcx>) { if std::env::var(OPENAI_API_KEY).is_err() { - cx.sess().warn(format!( + cx.sess().dcx().warn(format!( "`missing_doc_comment_openai` suggestions are disabled because environment \ variable `{OPENAI_API_KEY}` is not set" )); @@ -190,7 +190,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDocCommentOpenai { let response = match send_request(&api_key, &request) { Ok(response) => response, Err(error) => { - cx.sess().span_warn(fn_sig_span, error.to_string()); + cx.sess().dcx().span_warn(fn_sig_span, error.to_string()); return None; } }; @@ -200,7 +200,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDocCommentOpenai { .first() .and_then(|choice| extract_doc_comment(&choice.text)) .or_else(|| { - cx.sess().span_warn( + cx.sess().dcx().span_warn( fn_sig_span, format!("Could not extract doc comment from response: {response:#?}",), ); diff --git a/examples/experimental/missing_doc_comment_openai/ui/main.stderr b/examples/experimental/missing_doc_comment_openai/ui/main.stderr index a33954613..68dc699b2 100644 --- a/examples/experimental/missing_doc_comment_openai/ui/main.stderr +++ b/examples/experimental/missing_doc_comment_openai/ui/main.stderr @@ -11,5 +11,5 @@ help: use the following suggestion from OpenAI LL + /// A doc comment generated by OpenAI. | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/general/await_holding_span_guard/src/lib.rs b/examples/general/await_holding_span_guard/src/lib.rs index 8e86567c6..4935783ba 100644 --- a/examples/general/await_holding_span_guard/src/lib.rs +++ b/examples/general/await_holding_span_guard/src/lib.rs @@ -6,8 +6,8 @@ extern crate rustc_middle; use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::match_def_path; +use rustc_hir as hir; use rustc_hir::def_id::DefId; -use rustc_hir::{Body, CoroutineKind, CoroutineSource}; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::mir::CoroutineLayout; use rustc_middle::ty::Adt; @@ -86,11 +86,18 @@ const TRACING_SPAN_ENTER_GUARD: [&str; 3] = ["tracing", "span", "Entered"]; const TRACING_SPAN_ENTERED_GUARD: [&str; 3] = ["tracing", "span", "EnteredSpan"]; impl LateLintPass<'_> for AwaitHoldingSpanGuard { - fn check_body(&mut self, cx: &LateContext<'_>, body: &'_ Body<'_>) { - use CoroutineSource::{Block, Closure, Fn}; - if let Some(CoroutineKind::Async(Block | Closure | Fn)) = body.coroutine_kind { - let def_id = cx.tcx.hir().body_owner_def_id(body.id()); - if let Some(coroutine_layout) = cx.tcx.mir_coroutine_witnesses(def_id) { + fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'_ hir::Expr<'_>) { + if let hir::ExprKind::Closure(hir::Closure { + kind: + hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared( + hir::CoroutineDesugaring::Async, + _, + )), + def_id, + .. + }) = expr.kind + { + if let Some(coroutine_layout) = cx.tcx.mir_coroutine_witnesses(*def_id) { check_interior_types(cx, coroutine_layout); } } diff --git a/examples/general/crate_wide_allow/ui/main.stderr b/examples/general/crate_wide_allow/ui/main.stderr index e70cc8b40..4665103a0 100644 --- a/examples/general/crate_wide_allow/ui/main.stderr +++ b/examples/general/crate_wide_allow/ui/main.stderr @@ -8,5 +8,5 @@ LL | #![allow(clippy::assertions_on_constants)] = note: `-D crate-wide-allow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(crate_wide_allow)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/general/non_local_effect_before_error_return/src/lib.rs b/examples/general/non_local_effect_before_error_return/src/lib.rs index 32262a771..2e7ccad0f 100644 --- a/examples/general/non_local_effect_before_error_return/src/lib.rs +++ b/examples/general/non_local_effect_before_error_return/src/lib.rs @@ -184,7 +184,7 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalEffectBeforeErrorReturn { } fn in_async_function(tcx: ty::TyCtxt<'_>, hir_id: rustc_hir::HirId) -> bool { - std::iter::once((hir_id, tcx.hir().get(hir_id))) + std::iter::once((hir_id, tcx.hir_node(hir_id))) .chain(tcx.hir().parent_iter(hir_id)) .any(|(_, node)| { node.fn_kind() diff --git a/examples/general/non_local_effect_before_error_return/src/visit_error_paths.rs b/examples/general/non_local_effect_before_error_return/src/visit_error_paths.rs index e5b315c98..b4481ed2e 100644 --- a/examples/general/non_local_effect_before_error_return/src/visit_error_paths.rs +++ b/examples/general/non_local_effect_before_error_return/src/visit_error_paths.rs @@ -266,7 +266,7 @@ where FnKind::ItemFn(ident, _, _) | FnKind::Method(ident, _) => format!("`{ident}`"), FnKind::Closure => "closure".to_owned(), }; - self.cx.sess().warn(format!( + self.cx.sess().dcx().warn(format!( "reached work limit ({}) while checking {}; set `{}.work_limit` in `dylint.toml` \ to override", self.work_limit, diff --git a/examples/general/non_thread_safe_call_in_test/src/late.rs b/examples/general/non_thread_safe_call_in_test/src/late.rs index d63051710..c8456ad78 100644 --- a/examples/general/non_thread_safe_call_in_test/src/late.rs +++ b/examples/general/non_thread_safe_call_in_test/src/late.rs @@ -61,7 +61,7 @@ impl_lint_pass!(NonThreadSafeCallInTest => [NON_THREAD_SAFE_CALL_IN_TEST]); impl<'tcx> LateLintPass<'tcx> for NonThreadSafeCallInTest { fn check_crate(&mut self, cx: &LateContext<'tcx>) { if !cx.sess().opts.test { - cx.sess().warn( + cx.sess().dcx().warn( "`non_thread_safe_call_in_test` is unlikely to be effective as `--test` was not \ passed to rustc", ); diff --git a/examples/general/non_thread_safe_call_in_test/src/pre_expansion.rs b/examples/general/non_thread_safe_call_in_test/src/pre_expansion.rs index eb3dd0b9d..1a17b8eea 100644 --- a/examples/general/non_thread_safe_call_in_test/src/pre_expansion.rs +++ b/examples/general/non_thread_safe_call_in_test/src/pre_expansion.rs @@ -60,7 +60,7 @@ impl_lint_pass!(NonThreadSafeCallInTest => [NON_THREAD_SAFE_CALL_IN_TEST_PRE_EXP impl EarlyLintPass for NonThreadSafeCallInTest { fn check_crate(&mut self, cx: &EarlyContext, _crate: &Crate) { if !cx.sess().opts.test { - cx.sess().warn( + cx.sess().dcx().warn( "`non_thread_safe_call_in_test` is unlikely to be effective as `--test` was not \ passed to rustc", ); diff --git a/examples/general/non_thread_safe_call_in_test/ui_late/interprocedural.stderr b/examples/general/non_thread_safe_call_in_test/ui_late/interprocedural.stderr index d97b33ec3..072eac080 100644 --- a/examples/general/non_thread_safe_call_in_test/ui_late/interprocedural.stderr +++ b/examples/general/non_thread_safe_call_in_test/ui_late/interprocedural.stderr @@ -12,5 +12,5 @@ LL | fn foo() { = note: `-D non-thread-safe-call-in-test` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(non_thread_safe_call_in_test)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/general/non_thread_safe_call_in_test/ui_late/set_current_dir.stderr b/examples/general/non_thread_safe_call_in_test/ui_late/set_current_dir.stderr index b5f92a478..ff11914bd 100644 --- a/examples/general/non_thread_safe_call_in_test/ui_late/set_current_dir.stderr +++ b/examples/general/non_thread_safe_call_in_test/ui_late/set_current_dir.stderr @@ -12,5 +12,5 @@ LL | fn env_set_current_dir() { = note: `-D non-thread-safe-call-in-test` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(non_thread_safe_call_in_test)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/restriction/inconsistent_qualification/src/lib.rs b/examples/restriction/inconsistent_qualification/src/lib.rs index 664bcd8b8..c054059f5 100644 --- a/examples/restriction/inconsistent_qualification/src/lib.rs +++ b/examples/restriction/inconsistent_qualification/src/lib.rs @@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for InconsistentQualification { .hir() .parent_iter(hir_id) .any(|(hir_id, _)| cx.tcx.hir().span(hir_id).in_derive_expansion()); - let node = cx.tcx.hir().get(hir_id); + let node = cx.tcx.hir_node(hir_id); if !matches!( node, Node::Item(Item { @@ -94,7 +94,7 @@ impl<'tcx> LateLintPass<'tcx> for InconsistentQualification { syms_mod: &syms_mod, }; if let Some(enclosing_scope_hir_id) = enclosing_scope_hir_id { - let node = cx.tcx.hir().find(enclosing_scope_hir_id).unwrap(); + let node = cx.tcx.hir_node(enclosing_scope_hir_id); visitor.visit_scope(node); current_hir_id = enclosing_scope_hir_id; } else { @@ -235,7 +235,7 @@ fn is_local(res: Res) -> bool { } fn get_owner(tcx: TyCtxt<'_>, hir_id: HirId) -> Option> { - std::iter::once(tcx.hir().get(hir_id)) + std::iter::once(tcx.hir_node(hir_id)) .chain(tcx.hir().parent_iter(hir_id).map(|(_, node)| node)) .find_map(Node::as_owner) } diff --git a/examples/restriction/misleading_variable_name/src/lib.rs b/examples/restriction/misleading_variable_name/src/lib.rs index e1e42ab52..6d4d3532e 100644 --- a/examples/restriction/misleading_variable_name/src/lib.rs +++ b/examples/restriction/misleading_variable_name/src/lib.rs @@ -159,7 +159,7 @@ fn peel_try_unwrap_and_similar<'tcx>( ExprKind::Match(scrutinee, _, MatchSource::TryDesugar(_)) => { if let ExprKind::Call( Expr { - kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _, _)), + kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)), .. }, [arg], diff --git a/examples/restriction/overscoped_allow/src/lib.rs b/examples/restriction/overscoped_allow/src/lib.rs index 7b1039182..9e497e7ed 100644 --- a/examples/restriction/overscoped_allow/src/lib.rs +++ b/examples/restriction/overscoped_allow/src/lib.rs @@ -122,7 +122,8 @@ pub fn register_lints(sess: &Session, lint_store: &mut LintStore) { let diagnostics = match read_diagnostics() { Ok(diagnostics) => diagnostics, Err(error) => { - sess.warn(format!("`overscoped_allow` is disabled: {error:?}")); + sess.dcx() + .warn(format!("`overscoped_allow` is disabled: {error:?}")); Vec::new() } }; @@ -393,7 +394,7 @@ fn local_path_from_span(cx: &LateContext<'_>, span: Span) -> Option { } fn is_extern_crate_test(cx: &LateContext<'_>, hir_id: HirId) -> bool { - let node = cx.tcx.hir().get(hir_id); + let node = cx.tcx.hir_node(hir_id); if let Node::Item(Item { kind: ItemKind::ExternCrate(None), ident, @@ -408,7 +409,7 @@ fn is_extern_crate_test(cx: &LateContext<'_>, hir_id: HirId) -> bool { // smoelius: `can_have_attrs` is not complete. fn can_have_attrs(cx: &LateContext<'_>, hir_id: HirId) -> bool { - let node = cx.tcx.hir().get(hir_id); + let node = cx.tcx.hir_node(hir_id); if matches!(node, Node::Item(_) | Node::TraitItem(_) | Node::ImplItem(_)) { return true; diff --git a/examples/restriction/overscoped_allow/ui_test/main.stderr b/examples/restriction/overscoped_allow/ui_test/main.stderr index b9c249ebd..2659a8473 100644 --- a/examples/restriction/overscoped_allow/ui_test/main.stderr +++ b/examples/restriction/overscoped_allow/ui_test/main.stderr @@ -15,5 +15,5 @@ LL | fn panic() { = help: to override `-D warnings` add `#[allow(overscoped_allow)]` = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/restriction/question_mark_in_expression/src/lib.rs b/examples/restriction/question_mark_in_expression/src/lib.rs index 1775ef2a3..2e02916ae 100644 --- a/examples/restriction/question_mark_in_expression/src/lib.rs +++ b/examples/restriction/question_mark_in_expression/src/lib.rs @@ -88,7 +88,7 @@ fn get_filtered_ancestor<'hir>( if_chain! { if let ExprKind::Call(callee, _) = expr.kind; if let ExprKind::Path(path) = &callee.kind; - if let QPath::LangItem(LangItem::IntoIterIntoIter, _, _) = path; + if let QPath::LangItem(LangItem::IntoIterIntoIter, _) = path; then { child_hir_id = hir_id; continue; diff --git a/examples/restriction/question_mark_in_expression/ui/clone.stderr b/examples/restriction/question_mark_in_expression/ui/clone.stderr index 7a7f0af86..f830578a0 100644 --- a/examples/restriction/question_mark_in_expression/ui/clone.stderr +++ b/examples/restriction/question_mark_in_expression/ui/clone.stderr @@ -8,5 +8,5 @@ LL | let _ = git2::Repository::clone(DYLINT_URL, tempfile::tempdir()?.path() = note: `-D question-mark-in-expression` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(question_mark_in_expression)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/restriction/question_mark_in_expression/ui/ls.stderr b/examples/restriction/question_mark_in_expression/ui/ls.stderr index 4c2d8844e..7ece89a2f 100644 --- a/examples/restriction/question_mark_in_expression/ui/ls.stderr +++ b/examples/restriction/question_mark_in_expression/ui/ls.stderr @@ -8,5 +8,5 @@ LL | Ok(std::path::PathBuf::from(&std::env::var("PWD")?)) = note: `-D question-mark-in-expression` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(question_mark_in_expression)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/restriction/question_mark_in_expression/ui/non-empty.stderr b/examples/restriction/question_mark_in_expression/ui/non-empty.stderr index e2d30de8d..f3b8ff711 100644 --- a/examples/restriction/question_mark_in_expression/ui/non-empty.stderr +++ b/examples/restriction/question_mark_in_expression/ui/non-empty.stderr @@ -8,5 +8,5 @@ LL | if !std::fs::read_to_string("Cargo.toml")?.is_empty() { = note: `-D question-mark-in-expression` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(question_mark_in_expression)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/restriction/ref_aware_redundant_closure_for_method_calls/ui/eta.stderr b/examples/restriction/ref_aware_redundant_closure_for_method_calls/ui/eta.stderr index db05d4781..0a5813f77 100644 --- a/examples/restriction/ref_aware_redundant_closure_for_method_calls/ui/eta.stderr +++ b/examples/restriction/ref_aware_redundant_closure_for_method_calls/ui/eta.stderr @@ -7,5 +7,5 @@ LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo_ref()); = note: `-D ref-aware-redundant-closure-for-method-calls` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(ref_aware_redundant_closure_for_method_calls)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/restriction/try_io_result/src/lib.rs b/examples/restriction/try_io_result/src/lib.rs index e7908e079..d4e5ae9a1 100644 --- a/examples/restriction/try_io_result/src/lib.rs +++ b/examples/restriction/try_io_result/src/lib.rs @@ -56,7 +56,7 @@ impl<'tcx> LateLintPass<'tcx> for TryIoResult { if let ExprKind::Match(scrutinee, _, MatchSource::TryDesugar(_)) = expr.kind; if let ExprKind::Call(callee, [arg]) = scrutinee.kind; if let ExprKind::Path(path) = &callee.kind; - if matches!(path, QPath::LangItem(LangItem::TryTraitBranch, _, _)); + if matches!(path, QPath::LangItem(LangItem::TryTraitBranch, _)); if let arg_ty = cx.typeck_results().node_type(arg.hir_id); if is_io_result(cx, arg_ty); let body_owner_hir_id = cx.tcx.hir().enclosing_body_owner(expr.hir_id); diff --git a/examples/restriction/try_io_result/ui/main.stderr b/examples/restriction/try_io_result/ui/main.stderr index 8fca4e903..24d65e865 100644 --- a/examples/restriction/try_io_result/ui/main.stderr +++ b/examples/restriction/try_io_result/ui/main.stderr @@ -8,5 +8,5 @@ LL | let _ = File::open("/dev/null")?; = note: `-D try-io-result` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(try_io_result)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/supplementary/redundant_reference/src/lib.rs b/examples/supplementary/redundant_reference/src/lib.rs index caa90ca2a..1461c990f 100644 --- a/examples/supplementary/redundant_reference/src/lib.rs +++ b/examples/supplementary/redundant_reference/src/lib.rs @@ -162,8 +162,8 @@ impl<'tcx> LateLintPass<'tcx> for RedundantReference { { let item = cx.tcx.hir().expect_item(*local_def_id); if_chain! { - if let ItemKind::Struct(VariantData::Struct(field_defs, _), _) = &item.kind; - if let Some(field_def) = field_defs + if let ItemKind::Struct(VariantData::Struct{fields, ..}, _) = &item.kind; + if let Some(field_def) = fields .iter() .find(|field_def| field_def.ident == *field); let field_def_local_def_id = field_def.def_id; @@ -217,7 +217,6 @@ impl<'tcx> LateLintPass<'tcx> for RedundantReference { diag.help(format!( "consider storing a copy of `.{field}.{subfield}`{lifetime_help}" )); - diag }, ); } diff --git a/examples/supplementary/redundant_reference/ui/main.stderr b/examples/supplementary/redundant_reference/ui/main.stderr index 46cd98622..a366fec30 100644 --- a/examples/supplementary/redundant_reference/ui/main.stderr +++ b/examples/supplementary/redundant_reference/ui/main.stderr @@ -13,5 +13,5 @@ LL | self.cx.tcx.hir() = note: `-D redundant-reference` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(redundant_reference)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/supplementary/redundant_reference/ui_no_lifetime_check/main.stderr b/examples/supplementary/redundant_reference/ui_no_lifetime_check/main.stderr index 43fe3f7ae..46f3a44a7 100644 --- a/examples/supplementary/redundant_reference/ui_no_lifetime_check/main.stderr +++ b/examples/supplementary/redundant_reference/ui_no_lifetime_check/main.stderr @@ -13,5 +13,5 @@ LL | self.bar.qux = note: `-D redundant-reference` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(redundant_reference)]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/examples/supplementary/unnecessary_conversion_for_trait/src/check_inherents.rs b/examples/supplementary/unnecessary_conversion_for_trait/src/check_inherents.rs index a1a978ac3..73110261e 100644 --- a/examples/supplementary/unnecessary_conversion_for_trait/src/check_inherents.rs +++ b/examples/supplementary/unnecessary_conversion_for_trait/src/check_inherents.rs @@ -34,8 +34,8 @@ pub fn check_inherents(cx: &LateContext<'_>) { return false; } - let input_ty = cx.tcx.erase_late_bound_regions(fn_sig.input(0)); - let output_ty = cx.tcx.erase_late_bound_regions(fn_sig.output()); + let input_ty = fn_sig.input(0).skip_binder(); + let output_ty = fn_sig.output().skip_binder(); if let Some(input_item_ty) = implements_trait_with_item(cx, input_ty, into_iterator_def_id) { diff --git a/examples/supplementary/unnecessary_conversion_for_trait/src/lib.rs b/examples/supplementary/unnecessary_conversion_for_trait/src/lib.rs index fd0ed3d80..2d2117695 100644 --- a/examples/supplementary/unnecessary_conversion_for_trait/src/lib.rs +++ b/examples/supplementary/unnecessary_conversion_for_trait/src/lib.rs @@ -144,6 +144,9 @@ const IGNORED_INHERENTS: &[&[&str]] = &[ &["core", "slice", "", "as_chunks_unchecked_mut"], &["core", "str", "", "as_bytes_mut"], &["core", "str", "", "trim"], + &["core", "str", "", "trim_ascii"], + &["core", "str", "", "trim_ascii_end"], + &["core", "str", "", "trim_ascii_start"], &["core", "str", "", "trim_end"], &["core", "str", "", "trim_left"], &["core", "str", "", "trim_right"], diff --git a/examples/supplementary/unnecessary_conversion_for_trait/ui/vec.stderr b/examples/supplementary/unnecessary_conversion_for_trait/ui/vec.stderr index b0cf8f8ad..d64aa4388 100644 --- a/examples/supplementary/unnecessary_conversion_for_trait/ui/vec.stderr +++ b/examples/supplementary/unnecessary_conversion_for_trait/ui/vec.stderr @@ -8,5 +8,5 @@ LL | let _ = std::fs::write("x", vec![0]); = note: `-D unnecessary-conversion-for-trait` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unnecessary_conversion_for_trait)]` -error: aborting due to previous error +error: aborting due to 1 previous error