Fixed useless_let_if_seq clippy warnings
@@ -823,10 +823,9 @@ fn str_ljust(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
fn str_istitle(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
arg_check!(vm, args, required = [(s, Some(vm.ctx.str_type()))]);
let value = get_value(&s);
- let mut is_titled = true;
- if value.is_empty() {
- is_titled = false;
+ let mut is_titled = if value.is_empty() {
+ false
} else {
for word in value.split(' ') {
if word != make_title(&word) {
@@ -834,7 +833,10 @@ fn str_istitle(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
break;
}
}
- }
+
+ true
+ };
+
Ok(vm.ctx.new_bool(is_titled))
}
@@ -974,10 +976,8 @@ fn str_isdigit(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
let valid_unicodes: [u16; 10] = [
0x2070, 0x00B9, 0x00B2, 0x00B3, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078, 0x2079,
];
- let mut is_digit: bool = true;
-
- if value.is_empty() {
- is_digit = false;
+ let mut is_digit = if value.is_empty() {
+ false
} else {
for c in value.chars() {
if !c.is_digit(10) {
@@ -991,7 +991,9 @@ fn str_isdigit(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
}
}
}
- }
+
+ true
+ };
Ok(vm.ctx.new_bool(is_digit))
}
