X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=crates%2Fhir_def%2Fsrc%2Fkeys.rs;h=8cd2d771721493061b0f6acec96dfa7c9a820dc8;hb=0b53744f2d7e0694cd7207cca632fd6de1dc5bff;hp=93c92c1b9c94f347e51b9884ac5e3606b0d7ea09;hpb=e6e72809e3b55da3a57af95e6445a12729331ad6;p=rust.git diff --git a/crates/hir_def/src/keys.rs b/crates/hir_def/src/keys.rs index 93c92c1b9c9..8cd2d771721 100644 --- a/crates/hir_def/src/keys.rs +++ b/crates/hir_def/src/keys.rs @@ -34,7 +34,8 @@ pub const MACRO: Key = Key::new(); pub const ATTR_MACRO_CALL: Key = Key::new(); -pub const DERIVE_MACRO_CALL: Key]>)> = Key::new(); +pub const DERIVE_MACRO_CALL: Key]>)> = + Key::new(); /// XXX: AST Nodes and SyntaxNodes have identity equality semantics: nodes are /// equal if they point to exactly the same object. @@ -60,4 +61,7 @@ fn get<'a>(map: &'a DynMap, key: &AST) -> Option<&'a ID> { let key = AstPtr::new(key); map.map.get::, ID>>()?.get(&key) } + fn is_empty(map: &DynMap) -> bool { + map.map.get::, ID>>().map_or(true, |it| it.is_empty()) + } }