From 2acf442c9ba8d5faad69d8e52d7a0e641a825149 Mon Sep 17 00:00:00 2001 From: Jacherr Date: Thu, 7 Mar 2024 15:40:49 +0000 Subject: [PATCH] re-bless internal and update_lints --- clippy_lints/src/declared_lints.rs | 2 +- tests/ui-internal/unnecessary_def_path.stderr | 90 ++++--------------- 2 files changed, 16 insertions(+), 76 deletions(-) diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs index e0e438337757..7782ee888435 100644 --- a/clippy_lints/src/declared_lints.rs +++ b/clippy_lints/src/declared_lints.rs @@ -462,8 +462,8 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[ crate::methods::UNNECESSARY_JOIN_INFO, crate::methods::UNNECESSARY_LAZY_EVALUATIONS_INFO, crate::methods::UNNECESSARY_LITERAL_UNWRAP_INFO, - crate::methods::UNNECESSARY_RESULT_MAP_OR_ELSE_INFO, crate::methods::UNNECESSARY_MAP_OR_INFO, + crate::methods::UNNECESSARY_RESULT_MAP_OR_ELSE_INFO, crate::methods::UNNECESSARY_SORT_BY_INFO, crate::methods::UNNECESSARY_TO_OWNED_INFO, crate::methods::UNWRAP_OR_DEFAULT_INFO, diff --git a/tests/ui-internal/unnecessary_def_path.stderr b/tests/ui-internal/unnecessary_def_path.stderr index 2325a8ede745..79521c5037a8 100644 --- a/tests/ui-internal/unnecessary_def_path.stderr +++ b/tests/ui-internal/unnecessary_def_path.stderr @@ -1,9 +1,5 @@ error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:36:13 -======= - --> $DIR/unnecessary_def_path.rs:37:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:37:13 | LL | let _ = match_type(cx, ty, &OPTION); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Option)` @@ -16,101 +12,61 @@ LL | #![deny(clippy::internal)] = note: `#[deny(clippy::unnecessary_def_path)]` implied by `#[deny(clippy::internal)]` error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:37:13 -======= - --> $DIR/unnecessary_def_path.rs:38:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:38:13 | LL | let _ = match_type(cx, ty, RESULT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Result)` error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:38:13 -======= - --> $DIR/unnecessary_def_path.rs:39:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:39:13 | LL | let _ = match_type(cx, ty, &["core", "result", "Result"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Result)` error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:42:13 -======= - --> $DIR/unnecessary_def_path.rs:43:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:43:13 | LL | let _ = clippy_utils::ty::match_type(cx, ty, rc_path); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Rc)` error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:44:13 -======= - --> $DIR/unnecessary_def_path.rs:45:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:45:13 | LL | let _ = match_type(cx, ty, &paths::OPTION); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Option)` error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:45:13 -======= - --> $DIR/unnecessary_def_path.rs:46:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:46:13 | LL | let _ = match_type(cx, ty, paths::RESULT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Result)` error: use of a def path to a `LangItem` -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:47:13 -======= - --> $DIR/unnecessary_def_path.rs:48:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:48:13 | LL | let _ = match_type(cx, ty, &["alloc", "boxed", "Box"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_lang_item(cx, ty, LangItem::OwnedBox)` error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:48:13 -======= - --> $DIR/unnecessary_def_path.rs:49:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:49:13 | LL | let _ = match_type(cx, ty, &["core", "mem", "maybe_uninit", "MaybeUninit", "uninit"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::maybe_uninit_uninit)` error: use of a def path to a `LangItem` -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:50:13 -======= - --> $DIR/unnecessary_def_path.rs:51:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:51:13 | LL | let _ = match_def_path(cx, did, &["alloc", "boxed", "Box"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cx.tcx.lang_items().get(LangItem::OwnedBox) == Some(did)` error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:51:13 -======= - --> $DIR/unnecessary_def_path.rs:52:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:52:13 | LL | let _ = match_def_path(cx, did, &["core", "option", "Option"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cx.tcx.is_diagnostic_item(sym::Option, did)` error: use of a def path to a `LangItem` -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:52:13 -======= - --> $DIR/unnecessary_def_path.rs:53:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:53:13 | LL | let _ = match_def_path(cx, did, &["core", "option", "Option", "Some"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cx.tcx.lang_items().get(LangItem::OptionSome) == Some(did)` @@ -118,41 +74,25 @@ LL | let _ = match_def_path(cx, did, &["core", "option", "Option", "Some"]); = help: if this `DefId` came from a constructor expression or pattern then the parent `DefId` should be used instead error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:54:13 -======= - --> $DIR/unnecessary_def_path.rs:55:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:55:13 | LL | let _ = match_trait_method(cx, expr, &["core", "convert", "AsRef"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_trait_method(cx, expr, sym::AsRef)` error: use of a def path to a diagnostic item -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:56:13 -======= - --> $DIR/unnecessary_def_path.rs:57:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:57:13 | LL | let _ = is_expr_path_def_path(cx, expr, &["core", "option", "Option"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_path_diagnostic_item(cx, expr, sym::Option)` error: use of a def path to a `LangItem` -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:57:13 -======= - --> $DIR/unnecessary_def_path.rs:58:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:58:13 | LL | let _ = is_expr_path_def_path(cx, expr, &["core", "iter", "traits", "Iterator", "next"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `path_res(cx, expr).opt_def_id().map_or(false, |id| cx.tcx.lang_items().get(LangItem::IteratorNext) == Some(id))` error: use of a def path to a `LangItem` -<<<<<<< HEAD - --> tests/ui-internal/unnecessary_def_path.rs:58:13 -======= - --> $DIR/unnecessary_def_path.rs:59:13 ->>>>>>> c1f4d04ab (new lint `unnecessary_map_or`) + --> tests/ui-internal/unnecessary_def_path.rs:59:13 | LL | let _ = is_expr_path_def_path(cx, expr, &["core", "option", "Option", "Some"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_res_lang_ctor(cx, path_res(cx, expr), LangItem::OptionSome)`