mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Clippy
This commit is contained in:
@@ -380,11 +380,8 @@ fn builtin_max(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
|
||||
|
||||
if candidates.is_empty() {
|
||||
let default = args.get_optional_kwarg("default");
|
||||
if default.is_none() {
|
||||
return Err(vm.new_value_error("max() arg is an empty sequence".to_string()));
|
||||
} else {
|
||||
return Ok(default.unwrap());
|
||||
}
|
||||
return default
|
||||
.ok_or_else(|| vm.new_value_error("max() arg is an empty sequence".to_string()));
|
||||
}
|
||||
|
||||
let key_func = args.get_optional_kwarg("key");
|
||||
@@ -429,11 +426,8 @@ fn builtin_min(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
|
||||
|
||||
if candidates.is_empty() {
|
||||
let default = args.get_optional_kwarg("default");
|
||||
if default.is_none() {
|
||||
return Err(vm.new_value_error("min() arg is an empty sequence".to_string()));
|
||||
} else {
|
||||
return Ok(default.unwrap());
|
||||
}
|
||||
return default
|
||||
.ok_or_else(|| vm.new_value_error("min() arg is an empty sequence".to_string()));
|
||||
}
|
||||
|
||||
let key_func = args.get_optional_kwarg("key");
|
||||
|
||||
@@ -509,7 +509,7 @@ impl PyBytesRef {
|
||||
}
|
||||
}
|
||||
None => {
|
||||
if replacing_char.is_none() {
|
||||
if replacing_char.is_some() {
|
||||
decode_content.push(replacing_char.unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,19 +354,15 @@ impl PyRange {
|
||||
} else {
|
||||
tmp.clone()
|
||||
}
|
||||
} else {
|
||||
if slice_start > upper_bound {
|
||||
upper_bound.clone()
|
||||
} else {
|
||||
slice_start.clone()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if negative_step {
|
||||
} else if slice_start > upper_bound {
|
||||
upper_bound.clone()
|
||||
} else {
|
||||
lower_bound.clone()
|
||||
slice_start.clone()
|
||||
}
|
||||
} else if negative_step {
|
||||
upper_bound.clone()
|
||||
} else {
|
||||
lower_bound.clone()
|
||||
};
|
||||
|
||||
let substop = if let Some(slice_stop) = slice.stop_index(vm)? {
|
||||
@@ -377,19 +373,15 @@ impl PyRange {
|
||||
} else {
|
||||
tmp.clone()
|
||||
}
|
||||
} else {
|
||||
if slice_stop > upper_bound {
|
||||
upper_bound.clone()
|
||||
} else {
|
||||
slice_stop.clone()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if negative_step {
|
||||
lower_bound.clone()
|
||||
} else {
|
||||
} else if slice_stop > upper_bound {
|
||||
upper_bound.clone()
|
||||
} else {
|
||||
slice_stop.clone()
|
||||
}
|
||||
} else if negative_step {
|
||||
lower_bound.clone()
|
||||
} else {
|
||||
upper_bound.clone()
|
||||
};
|
||||
|
||||
let step = range_step * &substep;
|
||||
|
||||
Reference in New Issue
Block a user