Don't lint manual_clamp in const contexts.
This commit is contained in:
parent
b0e2e7bdb4
commit
797d8bff08
2 changed files with 23 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue