ok/jj
1
0
Fork 0
forked from mirrors/jj

templater: use .map_or() to silence clippy without sacrificing readability

This commit is contained in:
Yuya Nishihara 2024-06-29 17:04:15 +09:00
parent 0ca8502c5a
commit 3792f4a019

View file

@ -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)
}
}