File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Expand file tree Collapse file tree 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+ }
212
313fn main ( ) {
414 let i = 0u32 as u64 ;
515
616 let j = & i as * const u64 as * mut u64 ;
17+
18+ with_external_macro ( ) ;
719}
Original file line number Diff line number Diff line change 11error: using a potentially dangerous silent `as` conversion
2- --> $DIR/as_conversions.rs:4 :13
2+ --> $DIR/as_conversions.rs:14 :13
33 |
44LL | let i = 0u32 as u64;
55 | ^^^^^^^^^^^
@@ -8,15 +8,15 @@ LL | let i = 0u32 as u64;
88 = help: consider using a safe wrapper for this conversion
99
1010error: using a potentially dangerous silent `as` conversion
11- --> $DIR/as_conversions.rs:6 :13
11+ --> $DIR/as_conversions.rs:16 :13
1212 |
1313LL | let j = &i as *const u64 as *mut u64;
1414 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1515 |
1616 = help: consider using a safe wrapper for this conversion
1717
1818error: using a potentially dangerous silent `as` conversion
19- --> $DIR/as_conversions.rs:6 :13
19+ --> $DIR/as_conversions.rs:16 :13
2020 |
2121LL | let j = &i as *const u64 as *mut u64;
2222 | ^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -70,3 +70,17 @@ macro_rules! ref_arg_function {
7070 fn fun_example( ref _x: usize ) { }
7171 } ;
7272}
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