chore: apply clippy suggestions

This commit is contained in:
Cheong Lau 2025-10-05 12:27:32 +10:00 committed by Michael Murphy
parent 34f55d6720
commit a27bb5e05d
34 changed files with 116 additions and 146 deletions

View file

@ -546,7 +546,6 @@ where
}
/// Get the layout node of the actual text input
fn text_layout<'b>(&'a self, layout: Layout<'b>) -> Layout<'b> {
if self.dnd_icon {
layout
@ -1389,8 +1388,8 @@ pub fn update<'a, Message: Clone + 'static>(
if let Some(cursor_position) = click_position {
// Check if the edit button was clicked.
if state.dragging_state == None
&& edit_button_layout.map_or(false, |l| cursor.is_over(l.bounds()))
if state.dragging_state.is_none()
&& edit_button_layout.is_some_and(|l| cursor.is_over(l.bounds()))
{
if is_editable_variant {
state.is_read_only = !state.is_read_only;
@ -2277,7 +2276,7 @@ pub fn draw<'a, Message>(
let (cursor, offset) = if let Some(focus) =
state.is_focused.filter(|f| f.focused).or_else(|| {
let now = Instant::now();
handling_dnd_offer.then(|| Focus {
handling_dnd_offer.then_some(Focus {
needs_update: false,
updated_at: now,
now,

View file

@ -129,9 +129,7 @@ impl Value {
#[must_use]
pub fn secure(&self) -> Self {
Self {
graphemes: std::iter::repeat(String::from(""))
.take(self.graphemes.len())
.collect(),
graphemes: std::iter::repeat_n(String::from(""), self.graphemes.len()).collect(),
}
}
}