Repository: bevyengine/bevy
File: crates/bevy_ui/src/layout/convert.rs (Rust)

Code before:
        match (value.get_start(), value.get_end()) {
            (Some(start), Some(end)) => taffy::geometry::Line {
                start: style_helpers::line(start),
                end: style_helpers::line(end),
            },
            (Some(start), None) => taffy::geometry::Line {
                start: style_helpers::line(start),
                end: style_helpers::span(span),
            },
            (None, Some(end)) => taffy::geometry::Line {
                start: style_helpers::span(span),
                end: style_helpers::line(end),
            },
            (None, None) => style_helpers::span(span),
        }
    }
}

impl MinTrackSizingFunction {
    fn into_taffy(self, context: &LayoutContext) -> taffy::style::MinTrackSizingFunction {
        match self {
            MinTrackSizingFunction::Px(val) => taffy::style::MinTrackSizingFunction::length(
                Val::Px(val)
                    .into_length_percentage(context)
                    .into_raw()
                    .value(),
            ),
            MinTrackSizingFunction::Percent(val) => taffy::style::MinTrackSizingFunction::percent(
                Val::Percent(val)
                    .into_length_percentage(context)
                    .into_raw()
                    .value(),
            ),
            MinTrackSizingFunction::Auto => taffy::style::MinTrackSizingFunction::auto(),
            MinTrackSizingFunction::MinContent => {
                taffy::style::MinTrackSizingFunction::min_content()
            }
            MinTrackSizingFunction::MaxContent => {
                taffy::style::MinTrackSizingFunction::max_content()
            }
            MinTrackSizingFunction::VMin(val) => taffy::style::MinTrackSizingFunction::length(
                Val::VMin(val)
                    .into_length_percentage(context)
                    .into_raw()
                    .value(),
            ),
            MinTrackSizingFunction::VMax(val) => taffy::style::MinTrackSizingFunction::length(
                Val::VMax(val)
                    .into_length_percentage(context)
                    .into_raw()
                    .value(),

Review comment (suggestion):
I think just:
```suggestion
            MinTrackSizingFunction::Px(val) => Val::Px(val).into_length_percentage(context).into(),
```
should work, and so on for the rest.

Code after:
        match (value.get_start(), value.get_end()) {
            (Some(start), Some(end)) => taffy::geometry::Line {
                start: style_helpers::line(start),
                end: style_helpers::line(end),
            },
            (Some(start), None) => taffy::geometry::Line {
                start: style_helpers::line(start),
                end: style_helpers::span(span),
            },
            (None, Some(end)) => taffy::geometry::Line {
                start: style_helpers::span(span),
                end: style_helpers::line(end),
            },
            (None, None) => style_helpers::span(span),
        }
    }
}

impl MinTrackSizingFunction {
    fn into_taffy(self, context: &LayoutContext) -> taffy::style::MinTrackSizingFunction {
        match self {
            MinTrackSizingFunction::Px(val) => Val::Px(val).into_length_percentage(context).into(),
            MinTrackSizingFunction::Percent(val) => {
                Val::Percent(val).into_length_percentage(context).into()
            }
            MinTrackSizingFunction::Auto => taffy::style::MinTrackSizingFunction::auto(),
            MinTrackSizingFunction::MinContent => {
                taffy::style::MinTrackSizingFunction::min_content()
            }
            MinTrackSizingFunction::MaxContent => {
                taffy::style::MinTrackSizingFunction::max_content()
            }
            MinTrackSizingFunction::VMin(val) => {
                Val::VMin(val).into_length_percentage(context).into()
            }
            MinTrackSizingFunction::VMax(val) => {
                Val::VMax(val).into_length_percentage(context).into()
            }
            MinTrackSizingFunction::Vh(val) => Val::Vh(val).into_length_percentage(context).into(),
            MinTrackSizingFunction::Vw(val) => Val::Vw(val).into_length_percentage(context).into(),
        }
    }
}

impl MaxTrackSizingFunction {
    fn into_taffy(self, context: &LayoutContext) -> taffy::style::MaxTrackSizingFunction {
        match self {
            MaxTrackSizingFunction::Px(val) => Val::Px(val).into_length_percentage(context).into(),
            MaxTrackSizingFunction::Percent(val) => {
                Val::Percent(val).into_length_percentage(context).into()
            }