diff options
| author | bors <bors@rust-lang.org> | 2021-09-24 14:24:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-24 14:24:41 +0000 |
| commit | 2e38bc16ebcedd379c32849fc455f57f7116cc86 (patch) | |
| tree | 2b96eada2898d939ece53678bea7ad0a4f9a0902 | |
| parent | cd3f3cf8a85cb7e23194f1a755aa8b75a70a56ed (diff) | |
| parent | 7a4a556100dc6c060c9c2f464740c2f3286d30fb (diff) | |
| download | rust-2e38bc16ebcedd379c32849fc455f57f7116cc86.tar.gz rust-2e38bc16ebcedd379c32849fc455f57f7116cc86.zip | |
Auto merge of #7715 - F3real:vec2, r=camsteffen
Avoid needless heap allocation in box_collection Fix issue left from previous PR changelog: none. r? `@Manishearth`
| -rw-r--r-- | clippy_lints/src/types/box_collection.rs | 8 |
1 files 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<String> { +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 } |
