Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9c223d9

Browse files
committed
Add test for await in debug_assert!(..)
1 parent f16e383 commit 9c223d9

File tree

2 files changed

+38
-29
lines changed

2 files changed

+38
-29
lines changed

tests/ui/debug_assert_with_mut_call.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
// compile-flags: --edition=2018
12
#![feature(custom_inner_attributes)]
23
#![rustfmt::skip]
4+
#![warn(clippy::debug_assert_with_mut_call)]
35
#![allow(clippy::trivially_copy_pass_by_ref, clippy::cognitive_complexity, clippy::redundant_closure_call)]
46

57
struct S;
@@ -114,11 +116,18 @@ fn misc() {
114116
})());
115117
}
116118

119+
async fn debug_await() {
120+
debug_assert!(async {
121+
true
122+
}.await);
123+
}
124+
117125
fn main() {
118126
func_non_mutable();
119127
func_mutable();
120128
method_non_mutable();
121129
method_mutable();
122130

123131
misc();
132+
debug_await();
124133
}

tests/ui/debug_assert_with_mut_call.stderr

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,169 @@
11
error: do not call a function with mutable arguments inside of `debug_assert!`
2-
--> $DIR/debug_assert_with_mut_call.rs:40:19
2+
--> $DIR/debug_assert_with_mut_call.rs:42:19
33
|
44
LL | debug_assert!(bool_mut(&mut 3));
55
| ^^^^^^^^^^^^^^^^
66
|
7-
= note: `#[deny(clippy::debug_assert_with_mut_call)]` on by default
7+
= note: `-D clippy::debug-assert-with-mut-call` implied by `-D warnings`
88

99
error: do not call a function with mutable arguments inside of `debug_assert!`
10-
--> $DIR/debug_assert_with_mut_call.rs:41:20
10+
--> $DIR/debug_assert_with_mut_call.rs:43:20
1111
|
1212
LL | debug_assert!(!bool_mut(&mut 3));
1313
| ^^^^^^^^^^^^^^^^
1414

1515
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
16-
--> $DIR/debug_assert_with_mut_call.rs:43:25
16+
--> $DIR/debug_assert_with_mut_call.rs:45:25
1717
|
1818
LL | debug_assert_eq!(0, u32_mut(&mut 3));
1919
| ^^^^^^^^^^^^^^^
2020

2121
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
22-
--> $DIR/debug_assert_with_mut_call.rs:44:22
22+
--> $DIR/debug_assert_with_mut_call.rs:46:22
2323
|
2424
LL | debug_assert_eq!(u32_mut(&mut 3), 0);
2525
| ^^^^^^^^^^^^^^^
2626

2727
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
28-
--> $DIR/debug_assert_with_mut_call.rs:46:25
28+
--> $DIR/debug_assert_with_mut_call.rs:48:25
2929
|
3030
LL | debug_assert_ne!(1, u32_mut(&mut 3));
3131
| ^^^^^^^^^^^^^^^
3232

3333
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
34-
--> $DIR/debug_assert_with_mut_call.rs:47:22
34+
--> $DIR/debug_assert_with_mut_call.rs:49:22
3535
|
3636
LL | debug_assert_ne!(u32_mut(&mut 3), 1);
3737
| ^^^^^^^^^^^^^^^
3838

3939
error: do not call a function with mutable arguments inside of `debug_assert!`
40-
--> $DIR/debug_assert_with_mut_call.rs:62:19
40+
--> $DIR/debug_assert_with_mut_call.rs:64:19
4141
|
4242
LL | debug_assert!(S.bool_self_mut());
4343
| ^^^^^^^^^^^^^^^^^
4444

4545
error: do not call a function with mutable arguments inside of `debug_assert!`
46-
--> $DIR/debug_assert_with_mut_call.rs:63:20
46+
--> $DIR/debug_assert_with_mut_call.rs:65:20
4747
|
4848
LL | debug_assert!(!S.bool_self_mut());
4949
| ^^^^^^^^^^^^^^^^^
5050

5151
error: do not call a function with mutable arguments inside of `debug_assert!`
52-
--> $DIR/debug_assert_with_mut_call.rs:64:19
52+
--> $DIR/debug_assert_with_mut_call.rs:66:19
5353
|
5454
LL | debug_assert!(S.bool_self_ref_arg_mut(&mut 3));
5555
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5656

5757
error: do not call a function with mutable arguments inside of `debug_assert!`
58-
--> $DIR/debug_assert_with_mut_call.rs:65:19
58+
--> $DIR/debug_assert_with_mut_call.rs:67:19
5959
|
6060
LL | debug_assert!(S.bool_self_mut_arg_ref(&3));
6161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6262

6363
error: do not call a function with mutable arguments inside of `debug_assert!`
64-
--> $DIR/debug_assert_with_mut_call.rs:66:19
64+
--> $DIR/debug_assert_with_mut_call.rs:68:19
6565
|
6666
LL | debug_assert!(S.bool_self_mut_arg_mut(&mut 3));
6767
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6868

6969
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
70-
--> $DIR/debug_assert_with_mut_call.rs:68:22
70+
--> $DIR/debug_assert_with_mut_call.rs:70:22
7171
|
7272
LL | debug_assert_eq!(S.u32_self_mut(), 0);
7373
| ^^^^^^^^^^^^^^^^
7474

7575
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
76-
--> $DIR/debug_assert_with_mut_call.rs:69:22
76+
--> $DIR/debug_assert_with_mut_call.rs:71:22
7777
|
7878
LL | debug_assert_eq!(S.u32_self_mut_arg_ref(&3), 0);
7979
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
8080

8181
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
82-
--> $DIR/debug_assert_with_mut_call.rs:70:22
82+
--> $DIR/debug_assert_with_mut_call.rs:72:22
8383
|
8484
LL | debug_assert_eq!(S.u32_self_ref_arg_mut(&mut 3), 0);
8585
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8686

8787
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
88-
--> $DIR/debug_assert_with_mut_call.rs:71:22
88+
--> $DIR/debug_assert_with_mut_call.rs:73:22
8989
|
9090
LL | debug_assert_eq!(S.u32_self_mut_arg_mut(&mut 3), 0);
9191
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9292

9393
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
94-
--> $DIR/debug_assert_with_mut_call.rs:73:22
94+
--> $DIR/debug_assert_with_mut_call.rs:75:22
9595
|
9696
LL | debug_assert_ne!(S.u32_self_mut(), 1);
9797
| ^^^^^^^^^^^^^^^^
9898

9999
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
100-
--> $DIR/debug_assert_with_mut_call.rs:74:22
100+
--> $DIR/debug_assert_with_mut_call.rs:76:22
101101
|
102102
LL | debug_assert_ne!(S.u32_self_mut_arg_ref(&3), 1);
103103
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
104104

105105
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
106-
--> $DIR/debug_assert_with_mut_call.rs:75:22
106+
--> $DIR/debug_assert_with_mut_call.rs:77:22
107107
|
108108
LL | debug_assert_ne!(S.u32_self_ref_arg_mut(&mut 3), 1);
109109
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110110

111111
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
112-
--> $DIR/debug_assert_with_mut_call.rs:76:22
112+
--> $DIR/debug_assert_with_mut_call.rs:78:22
113113
|
114114
LL | debug_assert_ne!(S.u32_self_mut_arg_mut(&mut 3), 1);
115115
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116116

117117
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
118-
--> $DIR/debug_assert_with_mut_call.rs:84:22
118+
--> $DIR/debug_assert_with_mut_call.rs:86:22
119119
|
120120
LL | debug_assert_eq!(v.pop(), Some(1));
121121
| ^^^^^^^
122122

123123
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
124-
--> $DIR/debug_assert_with_mut_call.rs:85:31
124+
--> $DIR/debug_assert_with_mut_call.rs:87:31
125125
|
126126
LL | debug_assert_ne!(Some(3), v.pop());
127127
| ^^^^^^^
128128

129129
error: do not call a function with mutable arguments inside of `debug_assert!`
130-
--> $DIR/debug_assert_with_mut_call.rs:88:19
130+
--> $DIR/debug_assert_with_mut_call.rs:90:19
131131
|
132132
LL | debug_assert!(bool_mut(a));
133133
| ^^^^^^^^^^^
134134

135135
error: do not call a function with mutable arguments inside of `debug_assert!`
136-
--> $DIR/debug_assert_with_mut_call.rs:91:31
136+
--> $DIR/debug_assert_with_mut_call.rs:93:31
137137
|
138138
LL | debug_assert!(!(bool_ref(&u32_mut(&mut 3))));
139139
| ^^^^^^^^^^^^^^^
140140

141141
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
142-
--> $DIR/debug_assert_with_mut_call.rs:94:22
142+
--> $DIR/debug_assert_with_mut_call.rs:96:22
143143
|
144144
LL | debug_assert_eq!(v.pop().unwrap(), 3);
145145
| ^^^^^^^
146146

147147
error: do not call a function with mutable arguments inside of `debug_assert!`
148-
--> $DIR/debug_assert_with_mut_call.rs:98:19
148+
--> $DIR/debug_assert_with_mut_call.rs:100:19
149149
|
150150
LL | debug_assert!(bool_mut(&mut 3), "w/o format");
151151
| ^^^^^^^^^^^^^^^^
152152

153153
error: do not call a function with mutable arguments inside of `debug_assert!`
154-
--> $DIR/debug_assert_with_mut_call.rs:100:19
154+
--> $DIR/debug_assert_with_mut_call.rs:102:19
155155
|
156156
LL | debug_assert!(bool_mut(&mut 3), "{} format", "w/");
157157
| ^^^^^^^^^^^^^^^^
158158

159159
error: do not call a function with mutable arguments inside of `debug_assert!`
160-
--> $DIR/debug_assert_with_mut_call.rs:105:9
160+
--> $DIR/debug_assert_with_mut_call.rs:107:9
161161
|
162162
LL | bool_mut(&mut x);
163163
| ^^^^^^^^^^^^^^^^
164164

165165
error: do not call a function with mutable arguments inside of `debug_assert!`
166-
--> $DIR/debug_assert_with_mut_call.rs:112:9
166+
--> $DIR/debug_assert_with_mut_call.rs:114:9
167167
|
168168
LL | bool_mut(&mut x);
169169
| ^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)