mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
clippy fixes for rust 1.53
This commit is contained in:
@@ -46,7 +46,7 @@ impl Align {
|
||||
|
||||
/// Convert `Min => 0.0`, `Center => 0.5` or `Max => 1.0`.
|
||||
#[inline(always)]
|
||||
pub fn to_factor(&self) -> f32 {
|
||||
pub fn to_factor(self) -> f32 {
|
||||
match self {
|
||||
Self::Min => 0.0,
|
||||
Self::Center => 0.5,
|
||||
@@ -56,7 +56,7 @@ impl Align {
|
||||
|
||||
/// Convert `Min => -1.0`, `Center => 0.0` or `Max => 1.0`.
|
||||
#[inline(always)]
|
||||
pub fn to_sign(&self) -> f32 {
|
||||
pub fn to_sign(self) -> f32 {
|
||||
match self {
|
||||
Self::Min => -1.0,
|
||||
Self::Center => 0.0,
|
||||
@@ -104,7 +104,7 @@ impl Align2 {
|
||||
}
|
||||
|
||||
/// -1, 0, or +1 for each axis
|
||||
pub fn to_sign(&self) -> Vec2 {
|
||||
pub fn to_sign(self) -> Vec2 {
|
||||
vec2(self.x().to_sign(), self.y().to_sign())
|
||||
}
|
||||
|
||||
|
||||
@@ -230,9 +230,7 @@ pub fn format_with_decimals_in_range(value: f64, decimal_range: RangeInclusive<u
|
||||
let max_decimals = max_decimals.min(16);
|
||||
let min_decimals = min_decimals.min(max_decimals);
|
||||
|
||||
if min_decimals == max_decimals {
|
||||
format!("{:.*}", max_decimals, value)
|
||||
} else {
|
||||
if min_decimals != max_decimals {
|
||||
// Ugly/slow way of doing this. TODO: clean up precision.
|
||||
for decimals in min_decimals..max_decimals {
|
||||
let text = format!("{:.*}", decimals, value);
|
||||
@@ -245,8 +243,8 @@ pub fn format_with_decimals_in_range(value: f64, decimal_range: RangeInclusive<u
|
||||
// The value has more precision than we expected.
|
||||
// Probably the value was set not by the slider, but from outside.
|
||||
// In any case: show the full value
|
||||
format!("{:.*}", max_decimals, value)
|
||||
}
|
||||
format!("{:.*}", max_decimals, value)
|
||||
}
|
||||
|
||||
/// Return true when arguments are the same within some rounding error.
|
||||
|
||||
Reference in New Issue
Block a user