Don't lint manual_clamp in const contexts.

This commit is contained in:
Jason Newcomb 2023-03-10 11:07:28 -05:00
parent b0e2e7bdb4
commit 797d8bff08
2 changed files with 23 additions and 3 deletions

View file

@ -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;
}
}