File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -305,12 +305,14 @@ fn not_general_enough() {
305305}
306306
307307// https://github.com/rust-lang/rust-clippy/issues/9369
308- pub fn mutable_impl_fn_mut(mut f: impl FnMut()) {
308+ pub fn mutable_impl_fn_mut ( mut f : impl FnMut ( ) , mut f_used_once : impl FnMut ( ) ) -> impl FnMut ( ) {
309309 fn takes_fn_mut ( _: impl FnMut ( ) ) { }
310310 takes_fn_mut ( & mut f) ;
311311
312312 fn takes_fn_once ( _: impl FnOnce ( ) ) { }
313313 takes_fn_once ( & mut f) ;
314314
315315 f ( ) ;
316+
317+ move || takes_fn_mut ( & mut f_used_once)
316318}
Original file line number Diff line number Diff line change @@ -305,12 +305,14 @@ fn not_general_enough() {
305305}
306306
307307// https://github.com/rust-lang/rust-clippy/issues/9369
308- pub fn mutable_impl_fn_mut ( mut f : impl FnMut ( ) ) {
308+ pub fn mutable_impl_fn_mut ( mut f : impl FnMut ( ) , mut f_used_once : impl FnMut ( ) ) -> impl FnMut ( ) {
309309 fn takes_fn_mut ( _: impl FnMut ( ) ) { }
310310 takes_fn_mut ( || f ( ) ) ;
311311
312312 fn takes_fn_once ( _: impl FnOnce ( ) ) { }
313313 takes_fn_once ( || f ( ) ) ;
314314
315315 f ( ) ;
316+
317+ move || takes_fn_mut ( || f_used_once ( ) )
316318}
Original file line number Diff line number Diff line change @@ -128,5 +128,11 @@ error: redundant closure
128128LL | takes_fn_once(|| f());
129129 | ^^^^^^ help: replace the closure with the function itself: `&mut f`
130130
131- error: aborting due to 21 previous errors
131+ error: redundant closure
132+ --> $DIR/eta.rs:317:26
133+ |
134+ LL | move || takes_fn_mut(|| f_used_once())
135+ | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once`
136+
137+ error: aborting due to 22 previous errors
132138
You can’t perform that action at this time.
0 commit comments