File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -262,20 +262,11 @@ impl ExternalCrate {
262
262
// duplicately for the same primitive. This is handled later on when
263
263
// rendering by delegating everything to a hash map.
264
264
let as_primitive = |res: Res<!>| {
265
- if let Res::Def(DefKind::Mod, def_id) = res {
266
- let mut prim = None;
267
- for attr in tcx.get_attrs(def_id, sym::rustc_doc_primitive) {
268
- if let Some(v) = attr.value_str() {
269
- prim = PrimitiveType::from_symbol(v);
270
- if prim.is_some() {
271
- break;
272
- }
273
- // FIXME: should warn on unknown primitives?
274
- }
275
- }
276
- return prim.map(|p| (def_id, p));
277
- }
278
- None
265
+ let Res::Def(DefKind::Mod, def_id) = res else { return None };
266
+ tcx.get_attrs(def_id, sym::rustc_doc_primitive).find_map(|attr| {
267
+ // FIXME: should warn on unknown primitives?
268
+ Some((def_id, PrimitiveType::from_symbol(attr.value_str()?)?))
269
+ })
279
270
};
280
271
281
272
if root.is_local() {
You can’t perform that action at this time.
0 commit comments