refactor(workspace): sweep low-risk clippy::pedantic findings
Conservative cleanup pass — applied only the high-signal pedantic lints whose fixes either remove genuine waste or read more naturally, skipping anything stylistic that would bloat the diff. - map_unwrap_or: 29 .map(...).unwrap_or(...) sites collapsed to .map_or / .is_some_and / .map_or_else equivalents - uninlined_format_args: 7 production format!/write!/println! sites rewritten to the inline-argument style; assert! sites in test code intentionally untouched - match_same_arms: 2 redundant arms collapsed where the bodies were identical and the merger didn't obscure intent Public API is unchanged. No dependencies added or removed. The pedantic warning count dropped from 840 to 807 (-33). Out-of-scope findings — needless_pass_by_value on Bevy Res params, false-positive explicit_iter_loop on Bevy Query iterators, items_after_statements inside test mods, and the "ask before changing" merge logic in solitaire_sync — were intentionally deferred. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -212,9 +212,7 @@ fn evaluate_on_win(
|
||||
/// Convenience: resolve an achievement ID to its human-readable name.
|
||||
/// Used by the toast renderer in `animation_plugin`.
|
||||
pub fn display_name_for(id: &str) -> String {
|
||||
achievement_by_id(id)
|
||||
.map(|d| d.name.to_string())
|
||||
.unwrap_or_else(|| id.to_string())
|
||||
achievement_by_id(id).map_or_else(|| id.to_string(), |d| d.name.to_string())
|
||||
}
|
||||
|
||||
/// Marker on the "Done" button inside the Achievements modal.
|
||||
@@ -292,12 +290,10 @@ fn spawn_achievements_screen(
|
||||
|
||||
for record in &sorted {
|
||||
let def = achievement_by_id(&record.id);
|
||||
let (name, description) = def
|
||||
.map(|d| (d.name, d.description))
|
||||
.unwrap_or((&record.id, ""));
|
||||
let (name, description) = def.map_or((record.id.as_str(), ""), |d| (d.name, d.description));
|
||||
|
||||
// Hide secret locked achievements so they remain a surprise.
|
||||
let is_secret = def.map(|d| d.secret).unwrap_or(false);
|
||||
let is_secret = def.is_some_and(|d| d.secret);
|
||||
if is_secret && !record.unlocked {
|
||||
continue;
|
||||
}
|
||||
@@ -401,7 +397,7 @@ fn tooltip_for_row(unlocked: bool, def: Option<&AchievementDef>) -> String {
|
||||
None => "Earned!".to_string(),
|
||||
}
|
||||
} else {
|
||||
let description = def.map(|d| d.description).unwrap_or("");
|
||||
let description = def.map_or("", |d| d.description);
|
||||
let how = if description.is_empty() {
|
||||
"How to unlock: keep playing.".to_string()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user