diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/manual_clamp.rs')
-rw-r--r-- | src/tools/clippy/tests/ui/manual_clamp.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/manual_clamp.rs b/src/tools/clippy/tests/ui/manual_clamp.rs index f7902e6fd..cdfd8e4c3 100644 --- a/src/tools/clippy/tests/ui/manual_clamp.rs +++ b/src/tools/clippy/tests/ui/manual_clamp.rs @@ -326,3 +326,22 @@ fn msrv_1_50() { input }; } + +const fn _const() { + let (input, min, max) = (0, -1, 2); + let _ = if input < min { + min + } else if input > max { + max + } else { + input + }; + + let mut x = input; + if max < x { + let x = max; + } + if min > x { + x = min; + } +} |