From 7b76d31933051bb376df73b7000f0b8f1c748cb1 Mon Sep 17 00:00:00 2001 From: MrGVSV <gino.valente.code@gmail.com> Date: Mon, 7 Feb 2022 00:24:24 -0800 Subject: [PATCH] Formatting --- kayak_core/src/node.rs | 10 +++++----- kayak_core/src/styles.rs | 12 ++++++------ kayak_core/src/widget_manager.rs | 4 +--- src/widgets/button.rs | 2 +- src/widgets/text_box.rs | 2 +- src/widgets/tooltip.rs | 10 +++++++--- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/kayak_core/src/node.rs b/kayak_core/src/node.rs index 211a6bc..ac3b309 100644 --- a/kayak_core/src/node.rs +++ b/kayak_core/src/node.rs @@ -15,7 +15,7 @@ pub struct Node { impl Node {} pub struct NodeBuilder { - node: Node + node: Node, } impl NodeBuilder { @@ -26,8 +26,8 @@ impl NodeBuilder { id: Index::default(), resolved_styles: Style::default(), raw_styles: None, - z: 0.0 - } + z: 0.0, + }, } } @@ -38,8 +38,8 @@ impl NodeBuilder { id, resolved_styles: styles, raw_styles: None, - z: 0.0 - } + z: 0.0, + }, } } diff --git a/kayak_core/src/styles.rs b/kayak_core/src/styles.rs index bdebf85..3929618 100644 --- a/kayak_core/src/styles.rs +++ b/kayak_core/src/styles.rs @@ -21,8 +21,8 @@ pub enum StyleProp<T: Default + Clone> { } impl<T> Default for StyleProp<T> - where - T: Default + Clone, +where + T: Default + Clone, { fn default() -> Self { Self::Unset @@ -30,8 +30,8 @@ impl<T> Default for StyleProp<T> } impl<T> StyleProp<T> - where - T: Default + Clone, +where + T: Default + Clone, { pub fn resolve(&self) -> T { match self { @@ -48,7 +48,7 @@ impl<T> StyleProp<T> pub fn select<'a>(props: &'_ [&'a StyleProp<T>]) -> &'a Self { for prop in props { if !matches!(prop, StyleProp::Unset) { - return prop + return prop; } } @@ -231,4 +231,4 @@ impl AsRefOption<Style> for &Option<Style> { fn as_ref_option(&self) -> Option<&Style> { self.as_ref() } -} \ No newline at end of file +} diff --git a/kayak_core/src/widget_manager.rs b/kayak_core/src/widget_manager.rs index 05338f0..101a121 100644 --- a/kayak_core/src/widget_manager.rs +++ b/kayak_core/src/widget_manager.rs @@ -1,7 +1,5 @@ -use std::{ - sync::{Arc, Mutex}, -}; use indexmap::IndexSet; +use std::sync::{Arc, Mutex}; use crate::layout_cache::Rect; use crate::{ diff --git a/src/widgets/button.rs b/src/widgets/button.rs index ef4d0e3..d42de1f 100644 --- a/src/widgets/button.rs +++ b/src/widgets/button.rs @@ -52,7 +52,7 @@ pub fn Button(props: ButtonProps) { padding_left: StyleProp::Value(Units::Stretch(1.0)), padding_right: StyleProp::Value(Units::Stretch(1.0)), ..Default::default() - }) + }), ); rsx! { diff --git a/src/widgets/text_box.rs b/src/widgets/text_box.rs index 881941c..1a7514f 100644 --- a/src/widgets/text_box.rs +++ b/src/widgets/text_box.rs @@ -95,7 +95,7 @@ pub fn TextBox(props: TextBoxProps) { bottom: Units::Pixels(0.0).into(), height: Units::Pixels(26.0).into(), ..Default::default() - }) + }), ); let background_styles = Style { diff --git a/src/widgets/tooltip.rs b/src/widgets/tooltip.rs index 173de7f..71b5df9 100644 --- a/src/widgets/tooltip.rs +++ b/src/widgets/tooltip.rs @@ -111,13 +111,17 @@ pub fn TooltipProvider(props: TooltipProviderProps) { width: StyleProp::Value(Units::Pixels(size.0)), height: StyleProp::Value(Units::Pixels(size.1)), ..Default::default() - }) + }), ); let base_styles = props.styles.clone().unwrap(); let mut tooltip_styles = Style { position_type: StyleProp::Value(PositionType::SelfDirected), - background_color: StyleProp::select(&[&base_styles.background_color, &Color::new(0.13, 0.15, 0.17, 0.85).into()]).clone(), + background_color: StyleProp::select(&[ + &base_styles.background_color, + &Color::new(0.13, 0.15, 0.17, 0.85).into(), + ]) + .clone(), width: StyleProp::Value(Units::Pixels(tooltip_size.0)), height: StyleProp::Value(Units::Pixels(tooltip_size.1)), ..Style::default() @@ -206,7 +210,7 @@ pub fn TooltipConsumer(props: TooltipConsumerProps) { width: StyleProp::Value(Units::Auto), height: StyleProp::Value(Units::Auto), ..Default::default() - }) + }), ); let data = context -- GitLab