Skip to content

Commit

Permalink
templater: use .map_or() to silence clippy without sacrificing readab…
Browse files Browse the repository at this point in the history
…ility
  • Loading branch information
yuja committed Jun 30, 2024
1 parent 1b658ea commit 585908a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions cli/src/commit_templater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,15 +1027,8 @@ impl RefNamesIndex {
}
}

#[allow(unknown_lints)] // XXX FIXME (aseipp): nightly bogons; re-test this occasionally
#[allow(clippy::manual_unwrap_or_default)]
#[allow(clippy::manual_unwrap_or)] // https://github.com/rust-lang/rust-clippy/issues/13018
pub fn get(&self, id: &CommitId) -> &[Rc<RefName>] {
if let Some(names) = self.index.get(id) {
names
} else {
&[]
}
self.index.get(id).map_or(&[], |names: &Vec<_>| names)
}
}

Expand Down

0 comments on commit 585908a

Please sign in to comment.