File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -2887,9 +2887,9 @@ impl Context {
2887
2887
/// the function is still called, but with no other effect.
2888
2888
///
2889
2889
/// No locks are held while the given closure is called.
2890
- #[ allow( clippy:: unused_self) ]
2890
+ #[ allow( clippy:: unused_self, clippy :: let_and_return ) ]
2891
2891
#[ inline]
2892
- pub fn with_accessibility_parent ( & self , _id : Id , f : impl FnOnce ( ) ) {
2892
+ pub fn with_accessibility_parent < R > ( & self , _id : Id , f : impl FnOnce ( ) -> R ) -> R {
2893
2893
// TODO(emilk): this isn't thread-safe - another thread can call this function between the push/pop calls
2894
2894
#[ cfg( feature = "accesskit" ) ]
2895
2895
self . frame_state_mut ( |fs| {
@@ -2898,14 +2898,16 @@ impl Context {
2898
2898
}
2899
2899
} ) ;
2900
2900
2901
- f ( ) ;
2901
+ let result = f ( ) ;
2902
2902
2903
2903
#[ cfg( feature = "accesskit" ) ]
2904
2904
self . frame_state_mut ( |fs| {
2905
2905
if let Some ( state) = fs. accesskit_state . as_mut ( ) {
2906
2906
assert_eq ! ( state. parent_stack. pop( ) , Some ( _id) ) ;
2907
2907
}
2908
2908
} ) ;
2909
+
2910
+ result
2909
2911
}
2910
2912
2911
2913
/// If AccessKit support is active for the current frame, get or create
You can’t perform that action at this time.
0 commit comments