🚨 Fix some clippy warnings
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
use std::io::Cursor;
|
||||
|
||||
use image::imageops::FilterType;
|
||||
use image::io::Reader;
|
||||
use image::{DynamicImage, ImageFormat};
|
||||
use image::{DynamicImage, ImageFormat, ImageReader};
|
||||
use image::{GenericImage, RgbImage};
|
||||
use tracing::{error, warn};
|
||||
|
||||
@@ -13,7 +12,7 @@ cfg_if! {
|
||||
}
|
||||
|
||||
fn from_raw_to_image(raw: &Vec<u8>) -> Option<DynamicImage> {
|
||||
match Reader::new(Cursor::new(raw)).with_guessed_format() {
|
||||
match ImageReader::new(Cursor::new(raw)).with_guessed_format() {
|
||||
Ok(reader) => match reader.decode() {
|
||||
Ok(image) => return Some(image),
|
||||
Err(err) => error!("Unable to decode the image: {}", err),
|
||||
|
@@ -99,7 +99,7 @@ fn app() -> Element {
|
||||
}
|
||||
} else {
|
||||
rsx! {
|
||||
Login {},
|
||||
Login {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ macro_rules! svg_text_button {
|
||||
($name:ident,$style:ident,$icon:ident) => {
|
||||
pub fn $name(props: ButtonProps) -> Element {
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
style { {STYLE_SHEET} }
|
||||
|
||||
Button {
|
||||
id: props.id,
|
||||
@@ -79,7 +79,7 @@ pub struct ButtonProps {
|
||||
|
||||
pub fn Button(props: ButtonProps) -> Element {
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
style { {STYLE_SHEET} }
|
||||
|
||||
button {
|
||||
id: props.id,
|
||||
@@ -96,8 +96,8 @@ pub fn Button(props: ButtonProps) -> Element {
|
||||
}
|
||||
},
|
||||
|
||||
{props.children},
|
||||
},
|
||||
{props.children}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,8 @@ macro_rules! transparent_icon {
|
||||
($name:ident, $icon:ident) => {
|
||||
pub fn $name() -> Element {
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
style { {STYLE_SHEET} }
|
||||
|
||||
Icon {
|
||||
class: ClassName::TRANSPARENT_ICON,
|
||||
icon: $icon,
|
||||
@@ -52,7 +53,7 @@ impl IconShape for LogoShape {
|
||||
|
||||
pub fn LogoIcon() -> Element {
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
style { {STYLE_SHEET} }
|
||||
|
||||
Icon {
|
||||
icon: LogoShape,
|
||||
@@ -133,14 +134,14 @@ impl IconShape for PyramidShape {
|
||||
L {_PYRAMID_EDGES_E1_X} {_PYRAMID_CENTRAL_EDGE_E2_Y} \
|
||||
M {_PYRAMID_EDGES_E1_X} {_PYRAMID_EDGES_E1_Y} \
|
||||
V {_PYRAMID_CENTRAL_EDGE_Y_LEN}",
|
||||
},
|
||||
}
|
||||
path {
|
||||
d: "\
|
||||
M {_PYRAMID_CENTRAL_EDGE_E2_X} {_PYRAMID_CENTRAL_EDGE_E2_Y} \
|
||||
V {central_edge_ratio_e2_y} \
|
||||
L {left_edge_ratio_e1_x} {no_central_edge_ratio_e1_y} \
|
||||
L {_PYRAMID_LEFT_EDGE_E2_X} {_PYRAMID_LEFT_EDGE_E2_Y} Z",
|
||||
},
|
||||
}
|
||||
path {
|
||||
d: "\
|
||||
M {_PYRAMID_CENTRAL_EDGE_E2_X} {_PYRAMID_CENTRAL_EDGE_E2_Y} \
|
||||
@@ -168,10 +169,11 @@ pub fn Pyramid(props: PyramidProps) -> Element {
|
||||
.unwrap_or(COLOR_TERNARY_100.to_string());
|
||||
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
style { {STYLE_SHEET} }
|
||||
|
||||
Icon {
|
||||
class: ClassName::PYRAMID_ICON,
|
||||
|
||||
icon: PyramidShape { ratio: props.ratio, color, progress_color },
|
||||
}
|
||||
}
|
||||
|
@@ -97,27 +97,6 @@ impl Clone for Box<dyn OnValidationError> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct TextInputHandler {
|
||||
state: Signal<TextInputState>,
|
||||
}
|
||||
|
||||
impl TextInputHandler {}
|
||||
|
||||
impl OnValidationError for TextInputHandler {
|
||||
fn reset(&mut self) {
|
||||
self.state.write().reset();
|
||||
}
|
||||
|
||||
fn invalidate(&mut self, helper_text: String) {
|
||||
self.state.write().invalidate(helper_text);
|
||||
}
|
||||
|
||||
fn box_clone(&self) -> Box<dyn OnValidationError> {
|
||||
Box::new(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct UrlInputHandler {
|
||||
state: Signal<TextInputState>,
|
||||
@@ -744,7 +723,7 @@ pub fn Login() -> Element {
|
||||
let confirm_password_classes_str = confirm_password_classes.join(" ");
|
||||
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
style { {STYLE_SHEET} }
|
||||
|
||||
div {
|
||||
class: "{classes_str}",
|
||||
@@ -756,73 +735,79 @@ pub fn Login() -> Element {
|
||||
random_avatar_future.restart()
|
||||
},
|
||||
|
||||
{avatar},
|
||||
},
|
||||
{avatar}
|
||||
}
|
||||
|
||||
div {
|
||||
class: ClassName::LOGIN_HOMESERVER,
|
||||
|
||||
TextInput {
|
||||
placeholder: "Homeserver URL",
|
||||
value: "{homeserver_url}",
|
||||
state: homeserver_url_state,
|
||||
oninput: on_input![data, homeserver_url],
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
class: ClassName::LOGIN_ID,
|
||||
|
||||
TextInput {
|
||||
placeholder: "{id_placeholder}",
|
||||
value: "{id}",
|
||||
state: id_state,
|
||||
oninput: on_input![data, id],
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
class: "{password_classes_str}",
|
||||
|
||||
PasswordTextInput {
|
||||
placeholder: "Password",
|
||||
value: "{password}",
|
||||
state: password_state,
|
||||
oninput: on_input![data, password],
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
class: "{confirm_password_classes_str}",
|
||||
|
||||
PasswordTextInput {
|
||||
placeholder: "Confirm Password",
|
||||
value: "{confirm_password}",
|
||||
state: confirm_password_state,
|
||||
oninput: on_input![data, confirm_password],
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
div {
|
||||
class: ClassName::LOGIN_SPINNER,
|
||||
|
||||
Spinner {
|
||||
animate: *spinner_animated.read(),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
class: ClassName::LOGIN_REGISTER_BUTTON,
|
||||
|
||||
RegisterButton {
|
||||
onclick: on_clicked_register,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
class: ClassName::LOGIN_LOGIN_BUTTON,
|
||||
|
||||
LoginButton {
|
||||
focus: true,
|
||||
onclick: on_clicked_login,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{rendered_modal},
|
||||
{rendered_modal}
|
||||
}
|
||||
}
|
||||
|
@@ -76,7 +76,7 @@ pub fn Modal(props: ModalProps) -> Element {
|
||||
Severity::Critical => ErrorButton,
|
||||
};
|
||||
|
||||
icon.as_ref().ok_or(VNode::empty());
|
||||
let _ = icon.as_ref().ok_or(VNode::empty());
|
||||
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} }
|
||||
|
@@ -13,13 +13,14 @@ pub struct SpinnerProps {
|
||||
|
||||
pub fn Spinner(props: SpinnerProps) -> Element {
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
style { {STYLE_SHEET} }
|
||||
|
||||
div {
|
||||
class: ClassName::SPINNER,
|
||||
|
||||
Icon {
|
||||
class: if props.animate { "" } else { ClassName::PAUSED },
|
||||
|
||||
icon: LogoShape,
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,8 @@ pub fn Wallpaper(display_version: Option<bool>) -> Element {
|
||||
let version = display_version.map(|flag| if flag { Some(GIT_VERSION) } else { None });
|
||||
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
style { {STYLE_SHEET} }
|
||||
|
||||
div {
|
||||
class: ClassName::WALLPAPER,
|
||||
|
||||
@@ -20,7 +21,8 @@ pub fn Wallpaper(display_version: Option<bool>) -> Element {
|
||||
|
||||
div {
|
||||
class: ClassName::WALLPAPER_VERSION,
|
||||
{version},
|
||||
|
||||
{version}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ turf::style_sheet!("src/ui/layouts/login.scss");
|
||||
|
||||
pub fn Login() -> Element {
|
||||
rsx! {
|
||||
style { {STYLE_SHEET} },
|
||||
style { {STYLE_SHEET} }
|
||||
|
||||
Wallpaper {
|
||||
display_version: true
|
||||
|
Reference in New Issue
Block a user