forked from mirrors/jj
templater: use .map_or() to silence clippy without sacrificing readability
This commit is contained in:
parent
0ca8502c5a
commit
3792f4a019
1 changed files with 1 additions and 8 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue