File tree 3 files changed +30
-4
lines changed
3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 1
- #[ warn( clippy:: as_conversions) ]
1
+ // aux-build:macro_rules.rs
2
+
3
+ #![ warn( clippy:: as_conversions) ]
4
+
5
+ #[ macro_use]
6
+ extern crate macro_rules;
7
+
8
+ fn with_external_macro ( ) {
9
+ as_conv_with_arg ! ( 0u32 as u64 ) ;
10
+ as_conv ! ( ) ;
11
+ }
2
12
3
13
fn main ( ) {
4
14
let i = 0u32 as u64 ;
5
15
6
16
let j = & i as * const u64 as * mut u64 ;
17
+
18
+ with_external_macro ( ) ;
7
19
}
Original file line number Diff line number Diff line change 1
1
error: using a potentially dangerous silent `as` conversion
2
- --> $DIR/as_conversions.rs:4 :13
2
+ --> $DIR/as_conversions.rs:14 :13
3
3
|
4
4
LL | let i = 0u32 as u64;
5
5
| ^^^^^^^^^^^
@@ -8,15 +8,15 @@ LL | let i = 0u32 as u64;
8
8
= help: consider using a safe wrapper for this conversion
9
9
10
10
error: using a potentially dangerous silent `as` conversion
11
- --> $DIR/as_conversions.rs:6 :13
11
+ --> $DIR/as_conversions.rs:16 :13
12
12
|
13
13
LL | let j = &i as *const u64 as *mut u64;
14
14
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15
15
|
16
16
= help: consider using a safe wrapper for this conversion
17
17
18
18
error: using a potentially dangerous silent `as` conversion
19
- --> $DIR/as_conversions.rs:6 :13
19
+ --> $DIR/as_conversions.rs:16 :13
20
20
|
21
21
LL | let j = &i as *const u64 as *mut u64;
22
22
| ^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -70,3 +70,17 @@ macro_rules! ref_arg_function {
70
70
fn fun_example( ref _x: usize ) { }
71
71
} ;
72
72
}
73
+
74
+ #[ macro_export]
75
+ macro_rules! as_conv_with_arg {
76
+ ( 0u32 as u64 ) => {
77
+ ( )
78
+ } ;
79
+ }
80
+
81
+ #[ macro_export]
82
+ macro_rules! as_conv {
83
+ ( ) => {
84
+ 0u32 as u64
85
+ } ;
86
+ }
You can’t perform that action at this time.
0 commit comments