clippy fixes
This commit is contained in:
parent
9a51041ae2
commit
15b0214dff
4 changed files with 4 additions and 12 deletions
|
@ -125,7 +125,7 @@ pub fn round_to_precision(value: f64, decimal_places: usize) -> f64 {
|
|||
// This is a stupid way of doing this, but stupid works.
|
||||
format!("{:.*}", decimal_places, value)
|
||||
.parse()
|
||||
.unwrap_or_else(|_| value)
|
||||
.unwrap_or(value)
|
||||
}
|
||||
|
||||
pub fn format_with_minimum_precision(value: f32, precision: usize) -> String {
|
||||
|
|
|
@ -122,11 +122,7 @@ impl<'a> Widget for DragValue<'a> {
|
|||
|
||||
if is_kb_editing {
|
||||
let button_width = ui.style().spacing.interact_size.x;
|
||||
let mut value_text = ui
|
||||
.memory()
|
||||
.temp_edit_string
|
||||
.take()
|
||||
.unwrap_or_else(|| value_text);
|
||||
let mut value_text = ui.memory().temp_edit_string.take().unwrap_or(value_text);
|
||||
let response = ui.add(
|
||||
TextEdit::singleline(&mut value_text)
|
||||
.id(kb_edit_id)
|
||||
|
|
|
@ -119,7 +119,7 @@ impl Label {
|
|||
|
||||
/// Read the text style, or get the default for the current style
|
||||
pub fn text_style_or_default(&self, style: &Style) -> TextStyle {
|
||||
self.text_style.unwrap_or_else(|| style.body_text_style)
|
||||
self.text_style.unwrap_or(style.body_text_style)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -303,11 +303,7 @@ impl<'a> Slider<'a> {
|
|||
|
||||
if is_kb_editing {
|
||||
let button_width = ui.style().spacing.interact_size.x;
|
||||
let mut value_text = ui
|
||||
.memory()
|
||||
.temp_edit_string
|
||||
.take()
|
||||
.unwrap_or_else(|| value_text);
|
||||
let mut value_text = ui.memory().temp_edit_string.take().unwrap_or(value_text);
|
||||
ui.add(
|
||||
TextEdit::singleline(&mut value_text)
|
||||
.id(kb_edit_id)
|
||||
|
|
Loading…
Reference in a new issue