From 7a4a556100dc6c060c9c2f464740c2f3286d30fb Mon Sep 17 00:00:00 2001 From: F3real Date: Fri, 24 Sep 2021 11:02:16 +0200 Subject: [PATCH] Avoid needless heap allocation in box_collection --- clippy_lints/src/types/box_collection.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/types/box_collection.rs b/clippy_lints/src/types/box_collection.rs index 718aea471d9..b28da29c91c 100644 --- a/clippy_lints/src/types/box_collection.rs +++ b/clippy_lints/src/types/box_collection.rs @@ -37,13 +37,13 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_ } } -fn get_std_collection(cx: &LateContext<'_>, qpath: &QPath<'_>) -> Option { +fn get_std_collection(cx: &LateContext<'_>, qpath: &QPath<'_>) -> Option<&'static str> { if is_ty_param_diagnostic_item(cx, qpath, sym::vec_type).is_some() { - Some(String::from("Vec")) + Some("Vec") } else if is_ty_param_diagnostic_item(cx, qpath, sym::string_type).is_some() { - Some(String::from("String")) + Some("String") } else if is_ty_param_diagnostic_item(cx, qpath, sym::hashmap_type).is_some() { - Some(String::from("HashMap")) + Some("HashMap") } else { None }