Skip to content

Commit 7a4a556

Browse files
committed
Avoid needless heap allocation in box_collection
1 parent cd3f3cf commit 7a4a556

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clippy_lints/src/types/box_collection.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
3737
}
3838
}
3939

40-
fn get_std_collection(cx: &LateContext<'_>, qpath: &QPath<'_>) -> Option<String> {
40+
fn get_std_collection(cx: &LateContext<'_>, qpath: &QPath<'_>) -> Option<&'static str> {
4141
if is_ty_param_diagnostic_item(cx, qpath, sym::vec_type).is_some() {
42-
Some(String::from("Vec"))
42+
Some("Vec")
4343
} else if is_ty_param_diagnostic_item(cx, qpath, sym::string_type).is_some() {
44-
Some(String::from("String"))
44+
Some("String")
4545
} else if is_ty_param_diagnostic_item(cx, qpath, sym::hashmap_type).is_some() {
46-
Some(String::from("HashMap"))
46+
Some("HashMap")
4747
} else {
4848
None
4949
}

0 commit comments

Comments
 (0)