]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/debug_assert_with_mut_call.txt
Rollup merge of #101151 - jethrogb:jb/sgx-platform, r=JohnTitor
[rust.git] / src / tools / clippy / src / docs / debug_assert_with_mut_call.txt
1 ### What it does
2 Checks for function/method calls with a mutable
3 parameter in `debug_assert!`, `debug_assert_eq!` and `debug_assert_ne!` macros.
4
5 ### Why is this bad?
6 In release builds `debug_assert!` macros are optimized out by the
7 compiler.
8 Therefore mutating something in a `debug_assert!` macro results in different behavior
9 between a release and debug build.
10
11 ### Example
12 ```
13 debug_assert_eq!(vec![3].pop(), Some(3));
14
15 // or
16
17 debug_assert!(takes_a_mut_parameter(&mut x));
18 ```