clippy
This commit is contained in:
parent
df4b94edf2
commit
2dd6137459
19 changed files with 42 additions and 53 deletions
|
|
@ -69,7 +69,7 @@ pub trait Clipboard {
|
|||
/// Reads the current content of the [`Clipboard`] as text.
|
||||
fn read_data(
|
||||
&self,
|
||||
kind: Kind,
|
||||
_kind: Kind,
|
||||
_mimes: Vec<String>,
|
||||
) -> Option<(Vec<u8>, String)> {
|
||||
None
|
||||
|
|
@ -78,7 +78,7 @@ pub trait Clipboard {
|
|||
/// Writes the given contents to the [`Clipboard`].
|
||||
fn write_data(
|
||||
&mut self,
|
||||
kind: Kind,
|
||||
_kind: Kind,
|
||||
_contents: ClipboardStoreData<
|
||||
Box<dyn Send + Sync + 'static + mime::AsMimeTypes>,
|
||||
>,
|
||||
|
|
@ -119,7 +119,7 @@ pub trait Clipboard {
|
|||
}
|
||||
|
||||
/// Request window size
|
||||
fn request_logical_window_size(&self, width: f32, height: f32) {}
|
||||
fn request_logical_window_size(&self, _width: f32, _height: f32) {}
|
||||
}
|
||||
|
||||
/// The kind of [`Clipboard`].
|
||||
|
|
@ -187,10 +187,7 @@ pub fn peek_dnd<T: AllowedMimeTypes>(
|
|||
clipboard: &mut dyn Clipboard,
|
||||
mime: Option<String>,
|
||||
) -> Option<T> {
|
||||
let Some(mime) = mime.or_else(|| T::allowed().first().cloned().into())
|
||||
else {
|
||||
return None;
|
||||
};
|
||||
let mime = mime.or_else(|| T::allowed().first().cloned())?;
|
||||
clipboard
|
||||
.peek_dnd(mime)
|
||||
.and_then(|data| T::try_from(data).ok())
|
||||
|
|
@ -206,7 +203,7 @@ pub enum DndSource {
|
|||
}
|
||||
|
||||
/// A list of DnD destination rectangles.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct DndDestinationRectangles {
|
||||
/// The rectangle of the DnD destination.
|
||||
rectangles: Vec<DndDestinationRectangle>,
|
||||
|
|
@ -215,9 +212,7 @@ pub struct DndDestinationRectangles {
|
|||
impl DndDestinationRectangles {
|
||||
/// Creates a new [`DndDestinationRectangles`].
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
rectangles: Vec::new(),
|
||||
}
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Creates a new [`DndDestinationRectangles`] with the given capacity.
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ where
|
|||
}
|
||||
|
||||
fn diff(&mut self, tree: &mut Tree) {
|
||||
self.widget.diff(tree)
|
||||
self.widget.diff(tree);
|
||||
}
|
||||
|
||||
fn size(&self) -> Size<Length> {
|
||||
|
|
|
|||
|
|
@ -75,12 +75,12 @@ impl From<Id> for NonZeroU128 {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToString for Id {
|
||||
fn to_string(&self) -> String {
|
||||
impl std::fmt::Display for Id {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match &self.0 {
|
||||
Internal::Unique(_) => "Undefined".to_string(),
|
||||
Internal::Custom(_, id) => id.to_string(),
|
||||
Internal::Set(_) => "Set".to_string(),
|
||||
Internal::Unique(_) => write!(f, "Undefined"),
|
||||
Internal::Custom(_, id) => write!(f, "{}", id.to_string()),
|
||||
Internal::Set(_) => write!(f, "Set"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ use crate::mouse;
|
|||
use crate::overlay;
|
||||
use crate::renderer;
|
||||
use crate::widget;
|
||||
use crate::widget::Operation;
|
||||
use crate::{Clipboard, Event, Layout, Overlay, Point, Rectangle, Shell, Size};
|
||||
|
||||
/// An [`Overlay`] container that displays multiple overlay [`overlay::Element`]
|
||||
|
|
|
|||
|
|
@ -269,13 +269,13 @@ impl Tree {
|
|||
new_children.iter().map(|c| c.borrow().id()).collect(),
|
||||
|tree, widget| {
|
||||
let borrowed: &mut dyn Widget<_, _, _> = widget.borrow_mut();
|
||||
tree.diff(borrowed)
|
||||
tree.diff(borrowed);
|
||||
},
|
||||
|widget| {
|
||||
let borrowed: &dyn Widget<_, _, _> = widget.borrow();
|
||||
Self::new(borrowed)
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/// Reconciles the children of the tree with the provided list of widgets using custom
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue