Use Try syntax for Option in place of macros or match

This commit is contained in:
Matt Brubeck
2017-12-08 17:32:04 -08:00
parent c7b6d8263b
commit 3024c1434a
28 changed files with 92 additions and 230 deletions

View File

@@ -1672,11 +1672,8 @@ impl<'a> Item<'a> {
let mut path = String::new();
let (krate, path) = if self.item.def_id.is_local() {
let path = PathBuf::from(&self.item.source.filename);
if let Some(path) = self.cx.shared.local_sources.get(&path) {
(&self.cx.shared.layout.krate, path)
} else {
return None;
}
let path = self.cx.shared.local_sources.get(&path)?;
(&self.cx.shared.layout.krate, path)
} else {
// Macros from other libraries get special filenames which we can
// safely ignore.