@@ -3102,19 +3102,18 @@ impl Compiler {
3102
3102
Expr :: Tuple ( ExprTuple { elts, .. } ) => elts. iter ( ) . any ( Self :: contains_await) ,
3103
3103
Expr :: Set ( ExprSet { elts, .. } ) => elts. iter ( ) . any ( Self :: contains_await) ,
3104
3104
Expr :: Dict ( ExprDict { keys, values, .. } ) => {
3105
- keys. iter ( )
3106
- . any ( |key| key. as_ref ( ) . map_or ( false , Self :: contains_await) )
3105
+ keys. iter ( ) . flatten ( ) . any ( Self :: contains_await)
3107
3106
|| values. iter ( ) . any ( Self :: contains_await)
3108
3107
}
3109
3108
Expr :: Slice ( ExprSlice {
3110
3109
lower, upper, step, ..
3111
3110
} ) => {
3112
- lower. as_ref ( ) . map_or ( false , |l| Self :: contains_await ( l ) )
3113
- || upper. as_ref ( ) . map_or ( false , |u| Self :: contains_await ( u ) )
3114
- || step. as_ref ( ) . map_or ( false , |s| Self :: contains_await ( s ) )
3111
+ lower. as_deref ( ) . is_some_and ( Self :: contains_await)
3112
+ || upper. as_deref ( ) . is_some_and ( Self :: contains_await)
3113
+ || step. as_deref ( ) . is_some_and ( Self :: contains_await)
3115
3114
}
3116
3115
Expr :: Yield ( ExprYield { value, .. } ) => {
3117
- value. as_ref ( ) . map_or ( false , |v| Self :: contains_await ( v ) )
3116
+ value. as_deref ( ) . is_some_and ( Self :: contains_await)
3118
3117
}
3119
3118
Expr :: Await ( ExprAwait { .. } ) => true ,
3120
3119
Expr :: YieldFrom ( ExprYieldFrom { value, .. } ) => Self :: contains_await ( value) ,
@@ -3128,9 +3127,7 @@ impl Compiler {
3128
3127
..
3129
3128
} ) => {
3130
3129
Self :: contains_await ( value)
3131
- || format_spec
3132
- . as_ref ( )
3133
- . map_or ( false , |fs| Self :: contains_await ( fs) )
3130
+ || format_spec. as_deref ( ) . is_some_and ( Self :: contains_await)
3134
3131
}
3135
3132
Expr :: Name ( located_ast:: ExprName { .. } ) => false ,
3136
3133
Expr :: Lambda ( located_ast:: ExprLambda { body, .. } ) => Self :: contains_await ( body) ,
0 commit comments