Remove checked arithmetic from if expression hash tests
This commit is contained in:
parent
642468858f
commit
d1a83c6bd2
1 changed files with 4 additions and 4 deletions
|
@ -104,7 +104,7 @@ pub fn add_else_branch(x: bool) -> u32 {
|
||||||
let mut ret = 1;
|
let mut ret = 1;
|
||||||
|
|
||||||
if x {
|
if x {
|
||||||
ret += 1;
|
ret = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -119,7 +119,7 @@ pub fn add_else_branch(x: bool) -> u32 {
|
||||||
let mut ret = 1;
|
let mut ret = 1;
|
||||||
|
|
||||||
if x {
|
if x {
|
||||||
ret += 1;
|
ret = 2;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {
|
||||||
let mut ret = 1;
|
let mut ret = 1;
|
||||||
|
|
||||||
if let Some(x) = x {
|
if let Some(x) = x {
|
||||||
ret += x;
|
ret = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -224,7 +224,7 @@ pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {
|
||||||
let mut ret = 1;
|
let mut ret = 1;
|
||||||
|
|
||||||
if let Some(x) = x {
|
if let Some(x) = x {
|
||||||
ret += x;
|
ret = x;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue