janitor: use the new default attribute for enums

This commit is contained in:
Simon Hausmann 2022-12-05 09:39:28 +01:00 committed by Simon Hausmann
parent 7e77a2a4cc
commit 7122d22c88
10 changed files with 28 additions and 97 deletions

View file

@ -325,9 +325,10 @@ impl Default for Unit {
}
/// The Expression is hold by properties, so it should not hold any strong references to node from the object_tree
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub enum Expression {
/// Something went wrong (and an error will be reported)
#[default]
Invalid,
/// We haven't done the lookup yet
Uncompiled(SyntaxNode),
@ -504,12 +505,6 @@ pub enum Expression {
SolveLayout(crate::layout::Layout, crate::layout::Orientation),
}
impl Default for Expression {
fn default() -> Self {
Expression::Invalid
}
}
impl Expression {
/// Return the type of this property
pub fn ty(&self) -> Type {
@ -1342,20 +1337,15 @@ pub struct PathElement {
pub bindings: BindingsMap,
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub enum EasingCurve {
#[default]
Linear,
CubicBezier(f32, f32, f32, f32),
// CubicBezierNonConst([Box<Expression>; 4]),
// Custom(Box<dyn Fn(f32)->f32>),
}
impl Default for EasingCurve {
fn default() -> Self {
Self::Linear
}
}
// The compiler generates ResourceReference::AbsolutePath for all references like @image-url("foo.png")
// and the resource lowering path may change this to EmbeddedData if configured.
#[derive(Clone, Debug)]