- let &(ref fqp, shortty) = cache.external_paths.get(&did)?;
- let module_fqp = to_module_fqp(shortty, fqp);
- (
- fqp,
- shortty,
- match cache.extern_locations[&did.krate] {
- ExternalLocation::Remote(ref s) => {
- let s = s.trim_end_matches('/');
- let mut s = vec![&s[..]];
- s.extend(module_fqp[..].iter().map(String::as_str));
- s
- }
- ExternalLocation::Local => href_relative_parts(module_fqp, relative_to),
- ExternalLocation::Unknown => return None,
- },
- )
+ if let Some(&(ref fqp, shortty)) = cache.external_paths.get(&did) {
+ let module_fqp = to_module_fqp(shortty, fqp);
+ (
+ fqp,
+ shortty,
+ match cache.extern_locations[&did.krate] {
+ ExternalLocation::Remote(ref s) => {
+ let s = s.trim_end_matches('/');
+ let mut s = vec![&s[..]];
+ s.extend(module_fqp[..].iter().map(String::as_str));
+ s
+ }
+ ExternalLocation::Local => href_relative_parts(module_fqp, relative_to),
+ ExternalLocation::Unknown => return Err(HrefError::UnknownLocation),
+ },
+ )
+ } else {
+ return Err(HrefError::NotInExternalCache);
+ }