Auto merge of #46602 - mbrubeck:try, r=kennytm
Replace option_try macros and match with ? operator None
This commit is contained in:
commit
c89e206eed
28 changed files with 92 additions and 230 deletions
|
|
@ -425,15 +425,13 @@ pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> {
|
|||
Some(&(ref fqp, shortty)) => {
|
||||
(fqp, shortty, repeat("../").take(loc.len()).collect())
|
||||
}
|
||||
None => match cache.external_paths.get(&did) {
|
||||
Some(&(ref fqp, shortty)) => {
|
||||
(fqp, shortty, match cache.extern_locations[&did.krate] {
|
||||
(.., render::Remote(ref s)) => s.to_string(),
|
||||
(.., render::Local) => repeat("../").take(loc.len()).collect(),
|
||||
(.., render::Unknown) => return None,
|
||||
})
|
||||
}
|
||||
None => return None,
|
||||
None => {
|
||||
let &(ref fqp, shortty) = cache.external_paths.get(&did)?;
|
||||
(fqp, shortty, match cache.extern_locations[&did.krate] {
|
||||
(.., render::Remote(ref s)) => s.to_string(),
|
||||
(.., render::Local) => repeat("../").take(loc.len()).collect(),
|
||||
(.., render::Unknown) => return None,
|
||||
})
|
||||
}
|
||||
};
|
||||
for component in &fqp[..fqp.len() - 1] {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue