From 901bd5b0cd13dfb6fcd4626c41d32a8ff3d16179 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Mon, 28 Feb 2022 02:38:17 -0500 Subject: [PATCH] examples: clippy --- examples/borrowed.rs | 2 +- examples/calculator.rs | 4 ++-- examples/file_explorer.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/borrowed.rs b/examples/borrowed.rs index 815d6ceed..ddee43868 100644 --- a/examples/borrowed.rs +++ b/examples/borrowed.rs @@ -42,7 +42,7 @@ struct C1Props<'a> { } fn Child1<'a>(cx: Scope<'a, C1Props<'a>>) -> Element { - let (left, right) = cx.props.text.split_once("=").unwrap(); + let (left, right) = cx.props.text.split_once('=').unwrap(); cx.render(rsx! { div { diff --git a/examples/calculator.rs b/examples/calculator.rs index 5e23a3846..67cf40a5c 100644 --- a/examples/calculator.rs +++ b/examples/calculator.rs @@ -146,7 +146,6 @@ fn app(cx: Scope) -> Element { } fn calc_val(val: String) -> f64 { - let mut result; let mut temp = String::new(); let mut operation = "+".to_string(); @@ -169,7 +168,8 @@ fn calc_val(val: String) -> f64 { temp_value.push(c); start_index += 1; } - result = temp_value.parse::().unwrap(); + + let mut result = temp_value.parse::().unwrap(); if start_index + 1 >= val.len() { return result; diff --git a/examples/file_explorer.rs b/examples/file_explorer.rs index 728812027..cc578ba02 100644 --- a/examples/file_explorer.rs +++ b/examples/file_explorer.rs @@ -28,7 +28,7 @@ fn app(cx: Scope) -> Element { } main { files.read().path_names.iter().enumerate().map(|(dir_id, path)| { - let path_end = path.split('/').last().unwrap_or_else(|| path.as_str()); + let path_end = path.split('/').last().unwrap_or(path.as_str()); let icon_type = if path_end.contains('.') { "description" } else {