Skip to content

Commit 34bccea

Browse files
committed
version 0.2.1
1 parent b7d13e5 commit 34bccea

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "codeowners"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55

66
[profile.release]

src/ownership/validator.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,18 @@ impl Error {
174174
match self {
175175
Error::FileWithoutOwner { path } => vec![format!("- {}", path.to_string_lossy())],
176176
Error::FileWithMultipleOwners { path, owners } => {
177-
let mut output = vec![format!("\n{}", path.to_string_lossy().to_string())];
178-
for owner in owners.iter().sorted_by_key(|owner| owner.team_name.to_lowercase()) {
179-
output.push(format!(" owner: {}", owner.team_name));
180-
for source in &owner.sources {
181-
output.push(format!(" - {}", source));
182-
}
183-
}
184-
vec![output.join("\n")]
177+
let path_display = path.to_string_lossy();
178+
let mut messages = vec![format!("\n{path_display}")];
179+
180+
owners
181+
.iter()
182+
.sorted_by_key(|owner| owner.team_name.to_lowercase())
183+
.for_each(|owner| {
184+
messages.push(format!(" owner: {}", owner.team_name));
185+
messages.extend(owner.sources.iter().map(|source| format!(" - {source}")));
186+
});
187+
188+
vec![messages.join("\n")]
185189
}
186190
Error::CodeownershipFileIsStale => vec![],
187191
Error::InvalidTeam { name, path } => vec![format!("- {} is referencing an invalid team - '{}'", path.to_string_lossy(), name)],

0 commit comments

Comments
 (0)