mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
5572476a36
This lint will complain when you put a mutable function/method call inside a `debug_assert` macro, because it will not be executed in release mode, therefore it will change the execution flow, which is not wanted.
172 lines
6.4 KiB
Text
172 lines
6.4 KiB
Text
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:40:19
|
|
|
|
|
LL | debug_assert!(bool_mut(&mut 3));
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `#[deny(clippy::debug_assert_with_mut_call)]` on by default
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:41:20
|
|
|
|
|
LL | debug_assert!(!bool_mut(&mut 3));
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:43:25
|
|
|
|
|
LL | debug_assert_eq!(0, u32_mut(&mut 3));
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:44:22
|
|
|
|
|
LL | debug_assert_eq!(u32_mut(&mut 3), 0);
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:46:25
|
|
|
|
|
LL | debug_assert_ne!(1, u32_mut(&mut 3));
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:47:22
|
|
|
|
|
LL | debug_assert_ne!(u32_mut(&mut 3), 1);
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:62:19
|
|
|
|
|
LL | debug_assert!(S.bool_self_mut());
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:63:20
|
|
|
|
|
LL | debug_assert!(!S.bool_self_mut());
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:64:19
|
|
|
|
|
LL | debug_assert!(S.bool_self_ref_arg_mut(&mut 3));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:65:19
|
|
|
|
|
LL | debug_assert!(S.bool_self_mut_arg_ref(&3));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:66:19
|
|
|
|
|
LL | debug_assert!(S.bool_self_mut_arg_mut(&mut 3));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:68:22
|
|
|
|
|
LL | debug_assert_eq!(S.u32_self_mut(), 0);
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:69:22
|
|
|
|
|
LL | debug_assert_eq!(S.u32_self_mut_arg_ref(&3), 0);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:70:22
|
|
|
|
|
LL | debug_assert_eq!(S.u32_self_ref_arg_mut(&mut 3), 0);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:71:22
|
|
|
|
|
LL | debug_assert_eq!(S.u32_self_mut_arg_mut(&mut 3), 0);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:73:22
|
|
|
|
|
LL | debug_assert_ne!(S.u32_self_mut(), 1);
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:74:22
|
|
|
|
|
LL | debug_assert_ne!(S.u32_self_mut_arg_ref(&3), 1);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:75:22
|
|
|
|
|
LL | debug_assert_ne!(S.u32_self_ref_arg_mut(&mut 3), 1);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:76:22
|
|
|
|
|
LL | debug_assert_ne!(S.u32_self_mut_arg_mut(&mut 3), 1);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:84:22
|
|
|
|
|
LL | debug_assert_eq!(v.pop(), Some(1));
|
|
| ^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_ne!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:85:31
|
|
|
|
|
LL | debug_assert_ne!(Some(3), v.pop());
|
|
| ^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:88:19
|
|
|
|
|
LL | debug_assert!(bool_mut(a));
|
|
| ^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:91:31
|
|
|
|
|
LL | debug_assert!(!(bool_ref(&u32_mut(&mut 3))));
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert_eq!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:94:22
|
|
|
|
|
LL | debug_assert_eq!(v.pop().unwrap(), 3);
|
|
| ^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:98:19
|
|
|
|
|
LL | debug_assert!(bool_mut(&mut 3), "w/o format");
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:100:19
|
|
|
|
|
LL | debug_assert!(bool_mut(&mut 3), "{} format", "w/");
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:105:9
|
|
|
|
|
LL | bool_mut(&mut x);
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: do not call a function with mutable arguments inside of `debug_assert!`
|
|
--> $DIR/debug_assert_with_mut_call.rs:112:9
|
|
|
|
|
LL | bool_mut(&mut x);
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 28 previous errors
|
|
|