mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
don't Implement Display
for Val
(#10345)
# Objective - Revert #10296 ## Solution - Avoid implementing `Display` without a justification - `Display` implementation is a guarantee without a direct use, takes additional time to compile and require work to maintain - `Debug`, `Reflect` or `Serialize` should cover all needs
This commit is contained in:
parent
6f8848a6c2
commit
0dfb6cf89b
1 changed files with 0 additions and 17 deletions
|
@ -4,7 +4,6 @@ use bevy_reflect::ReflectDeserialize;
|
||||||
use bevy_reflect::ReflectSerialize;
|
use bevy_reflect::ReflectSerialize;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::fmt::Display;
|
|
||||||
use std::ops::Neg;
|
use std::ops::Neg;
|
||||||
use std::ops::{Div, DivAssign, Mul, MulAssign};
|
use std::ops::{Div, DivAssign, Mul, MulAssign};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -156,22 +155,6 @@ impl DivAssign<f32> for Val {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Val {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
let (value, suffix) = match self {
|
|
||||||
Val::Auto => return write!(f, "auto"),
|
|
||||||
Val::Px(value) => (value, "px"),
|
|
||||||
Val::Percent(value) => (value, "%"),
|
|
||||||
Val::Vw(value) => (value, "vw"),
|
|
||||||
Val::Vh(value) => (value, "vh"),
|
|
||||||
Val::VMin(value) => (value, "vmin"),
|
|
||||||
Val::VMax(value) => (value, "vmax"),
|
|
||||||
};
|
|
||||||
value.fmt(f)?;
|
|
||||||
write!(f, "{suffix}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Neg for Val {
|
impl Neg for Val {
|
||||||
type Output = Val;
|
type Output = Val;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue