summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-09-23 17:51:42 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-09-23 17:51:42 +0200
commit3e82ab069e6003b123dc133e8f4bcfd1a37ea93d (patch)
tree917093c2bd5025c8f93ef98d7dbf0637823c56f9
parent7420ea7a6b80663cad178c1238c5b756232a087f (diff)
downloadiced-3e82ab069e6003b123dc133e8f4bcfd1a37ea93d.tar.gz
iced-3e82ab069e6003b123dc133e8f4bcfd1a37ea93d.tar.bz2
iced-3e82ab069e6003b123dc133e8f4bcfd1a37ea93d.zip
Fix latest `clippy` lints
-rw-r--r--lazy/src/cache.rs2
-rw-r--r--native/src/widget/pick_list.rs8
-rw-r--r--native/src/widget/text_input.rs24
3 files changed, 16 insertions, 18 deletions
diff --git a/lazy/src/cache.rs b/lazy/src/cache.rs
index 229b7912..5b4a39f6 100644
--- a/lazy/src/cache.rs
+++ b/lazy/src/cache.rs
@@ -9,5 +9,5 @@ pub struct Cache<'a, Message: 'a, Renderer: 'a> {
#[borrows(mut element)]
#[covariant]
- pub overlay: Option<overlay::Element<'this, Message, Renderer>>,
+ overlay: Option<overlay::Element<'this, Message, Renderer>>,
}
diff --git a/native/src/widget/pick_list.rs b/native/src/widget/pick_list.rs
index 1232878b..c334804e 100644
--- a/native/src/widget/pick_list.rs
+++ b/native/src/widget/pick_list.rs
@@ -543,9 +543,11 @@ pub fn draw<T, Renderer>(
content: label,
size: text_size,
font: font.clone(),
- color: is_selected
- .then(|| style.text_color)
- .unwrap_or(style.placeholder_color),
+ color: if is_selected {
+ style.text_color
+ } else {
+ style.placeholder_color
+ },
bounds: Rectangle {
x: bounds.x + f32::from(padding.left),
y: bounds.center_y() - text_size / 2.0,
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index 8ddbc734..c2d25520 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -615,25 +615,21 @@ where
keyboard::KeyCode::C
if state.keyboard_modifiers.command() =>
{
- match state.cursor.selection(value) {
- Some((start, end)) => {
- clipboard.write(
- value.select(start, end).to_string(),
- );
- }
- None => {}
+ if let Some((start, end)) =
+ state.cursor.selection(value)
+ {
+ clipboard
+ .write(value.select(start, end).to_string());
}
}
keyboard::KeyCode::X
if state.keyboard_modifiers.command() =>
{
- match state.cursor.selection(value) {
- Some((start, end)) => {
- clipboard.write(
- value.select(start, end).to_string(),
- );
- }
- None => {}
+ if let Some((start, end)) =
+ state.cursor.selection(value)
+ {
+ clipboard
+ .write(value.select(start, end).to_string());
}
let mut editor = Editor::new(value, &mut state.cursor);