File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -105,15 +105,14 @@ pub struct ItemTree {
105
105
impl ItemTree {
106
106
pub ( crate ) fn file_item_tree_query ( db : & dyn DefDatabase , file_id : HirFileId ) -> Arc < ItemTree > {
107
107
let _p = profile:: span ( "item_tree_query" ) . detail ( || format ! ( "{:?}" , file_id) ) ;
108
- let syntax = if let Some ( node) = db. parse_or_expand ( file_id) {
109
- if node. kind ( ) == SyntaxKind :: ERROR {
110
- // FIXME: not 100% sure why these crop up, but return an empty tree to avoid a panic
111
- return Default :: default ( ) ;
112
- }
113
- node
114
- } else {
115
- return Default :: default ( ) ;
108
+ let syntax = match db. parse_or_expand ( file_id) {
109
+ Some ( node) => node,
110
+ None => return Default :: default ( ) ,
116
111
} ;
112
+ if syntax. kind ( ) == SyntaxKind :: ERROR {
113
+ // FIXME: not 100% sure why these crop up, but return an empty tree to avoid a panic
114
+ return Default :: default ( ) ;
115
+ }
117
116
118
117
let hygiene = Hygiene :: new ( db. upcast ( ) , file_id) ;
119
118
let ctx = lower:: Ctx :: new ( db, hygiene. clone ( ) , file_id) ;
You can’t perform that action at this time.
0 commit comments