@@ -12,7 +12,8 @@ use crate::expr::fmt::ExprFormatter;
1212use crate :: expr:: objects:: Arenas ;
1313use crate :: {
1414 ConcreteStructId , Condition , Expr , ExprFunctionCallArg , ExprId , ExprVarMemberPath ,
15- FixedSizeArrayItems , FunctionBody , Parameter , Pattern , PatternId , Statement , VarId ,
15+ FixedSizeArrayItems , FunctionBody , Parameter , Pattern , PatternId , Statement , StatementLet ,
16+ VarId ,
1617} ;
1718
1819#[ cfg( test) ]
@@ -233,9 +234,18 @@ impl Usages {
233234 let mut usage = Default :: default ( ) ;
234235 for stmt in & expr. statements {
235236 match & arenas. statements [ * stmt] {
236- Statement :: Let ( stmt) => {
237- self . handle_expr ( arenas, stmt. expr , & mut usage) ;
238- Self :: handle_pattern ( & arenas. patterns , stmt. pattern , & mut usage) ;
237+ Statement :: Let ( StatementLet {
238+ pattern,
239+ expr,
240+ else_clause,
241+ stable_ptr : _,
242+ } ) => {
243+ self . handle_expr ( arenas, * expr, & mut usage) ;
244+ Self :: handle_pattern ( & arenas. patterns , * pattern, & mut usage) ;
245+
246+ if let Some ( else_clause) = else_clause {
247+ self . handle_expr ( arenas, * else_clause, & mut usage) ;
248+ }
239249 }
240250 Statement :: Expr ( stmt) => self . handle_expr ( arenas, stmt. expr , & mut usage) ,
241251 Statement :: Continue ( _) => ( ) ,
0 commit comments