Fix clippy lints

This commit is contained in:
Héctor Ramón Jiménez 2023-09-13 16:31:56 +02:00
parent f4c51a96d5
commit f14ef7a606
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 41 additions and 22 deletions

View file

@ -210,9 +210,9 @@ where
/// Creates a new [`TextEditor`].
///
/// [`TextEditor`]: crate::TextEditor
pub fn text_editor<'a, Message, Renderer>(
content: &'a text_editor::Content<Renderer>,
) -> TextEditor<'a, Message, Renderer>
pub fn text_editor<Message, Renderer>(
content: &text_editor::Content<Renderer>,
) -> TextEditor<'_, Message, Renderer>
where
Message: Clone,
Renderer: core::text::Renderer,

View file

@ -7,8 +7,8 @@ use crate::core::text::editor::{Cursor, Editor as _};
use crate::core::text::{self, LineHeight};
use crate::core::widget::{self, Widget};
use crate::core::{
Clipboard, Color, Element, Length, Padding, Pixels, Point, Rectangle,
Shell, Vector,
Clipboard, Color, Element, Length, Padding, Pixels, Rectangle, Shell,
Vector,
};
use std::cell::RefCell;
@ -205,8 +205,12 @@ where
Update::Edit(action) => {
shell.publish(on_edit(action));
}
Update::Copy => {}
Update::Paste => if let Some(_contents) = clipboard.read() {},
Update::Copy => todo!(),
Update::Paste => {
if let Some(_contents) = clipboard.read() {
todo!()
}
}
}
event::Status::Captured
@ -353,7 +357,6 @@ impl Update {
cursor: mouse::Cursor,
) -> Option<Self> {
let edit = |action| Some(Update::Edit(action));
let move_ = |motion| Some(Update::Edit(Action::Move(motion)));
match event {
Event::Mouse(event) => match event {
@ -399,11 +402,12 @@ impl Update {
modifiers,
} if state.is_focused => {
if let Some(motion) = motion(key_code) {
let motion = if modifiers.control() {
motion.widen()
} else {
motion
};
let motion =
if platform::is_jump_modifier_pressed(modifiers) {
motion.widen()
} else {
motion
};
return edit(if modifiers.shift() {
Action::Select(motion)
@ -417,6 +421,12 @@ impl Update {
keyboard::KeyCode::Backspace => edit(Action::Backspace),
keyboard::KeyCode::Delete => edit(Action::Delete),
keyboard::KeyCode::Escape => Some(Self::Unfocus),
keyboard::KeyCode::C => Some(Self::Copy),
keyboard::KeyCode::V
if modifiers.command() && !modifiers.alt() =>
{
Some(Self::Paste)
}
_ => None,
}
}