Skip to content

Commit c8d619c

Browse files
committed
Fixed useless_let_if_seq clippy warnings
1 parent d5b8755 commit c8d619c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

vm/src/obj/objstr.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -823,18 +823,20 @@ fn str_ljust(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
823823
fn str_istitle(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
824824
arg_check!(vm, args, required = [(s, Some(vm.ctx.str_type()))]);
825825
let value = get_value(&s);
826-
let mut is_titled = true;
827826

828-
if value.is_empty() {
829-
is_titled = false;
827+
let mut is_titled = if value.is_empty() {
828+
false
830829
} else {
831830
for word in value.split(' ') {
832831
if word != make_title(&word) {
833832
is_titled = false;
834833
break;
835834
}
836835
}
837-
}
836+
837+
true
838+
};
839+
838840
Ok(vm.ctx.new_bool(is_titled))
839841
}
840842

@@ -974,10 +976,8 @@ fn str_isdigit(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
974976
let valid_unicodes: [u16; 10] = [
975977
0x2070, 0x00B9, 0x00B2, 0x00B3, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078, 0x2079,
976978
];
977-
let mut is_digit: bool = true;
978-
979-
if value.is_empty() {
980-
is_digit = false;
979+
let mut is_digit = if value.is_empty() {
980+
false
981981
} else {
982982
for c in value.chars() {
983983
if !c.is_digit(10) {
@@ -991,7 +991,9 @@ fn str_isdigit(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
991991
}
992992
}
993993
}
994-
}
994+
995+
true
996+
};
995997

996998
Ok(vm.ctx.new_bool(is_digit))
997999
}

0 commit comments

Comments
 (0)