Skip to content

Commit 1b7f7a8

Browse files
committed
hmm
1 parent 9157ded commit 1b7f7a8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

clippy_config/src/conf.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::unnecessary_collect)]
12
use crate::ClippyConfiguration;
23
use crate::types::{
34
DisallowedPath, DisallowedPathWithoutReplacement, MacroMatcher, MatchLintBehaviour, PubUnderscoreFieldsBehaviour,
@@ -959,10 +960,10 @@ fn deserialize(file: &SourceFile) -> TryConf {
959960
// info for the user instead.
960961

961962
let names = conf.conf.module_item_order_groupings.grouping_names();
962-
let suggestion = suggest_candidate(grouping, names.iter().map(String::as_str))
963+
let suggestion = suggest_candidate(grouping, names.clone())
963964
.map(|s| format!(" perhaps you meant `{s}`?"))
964965
.unwrap_or_default();
965-
let names = names.iter().map(|s| format!("`{s}`")).join(", ");
966+
let names = names.map(|s| format!("`{s}`")).join(", ");
966967
let message = format!(
967968
"unknown ordering group: `{grouping}` was not specified in `module-items-ordered-within-groupings`,{suggestion} expected one of: {names}"
968969
);

clippy_config/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ impl SourceItemOrderingModuleItemGroupings {
422422
self.back_lut.get(item)
423423
}
424424

425-
pub fn grouping_names(&self) -> Vec<String> {
426-
self.groups.iter().map(|(name, _)| name.clone()).collect()
425+
pub fn grouping_names(&self) -> impl Iterator<Item = &str> + Clone {
426+
self.groups.iter().map(|(name, _)| &**name)
427427
}
428428

429429
pub fn is_grouping(&self, grouping: &str) -> bool {

0 commit comments

Comments
 (0)