]> git.proxmox.com Git - ui/proxmox-yew-widget-toolkit.git/commitdiff
tree wide: allow type complexity lints where necessary
authorShannon Sterz <s.sterz@proxmox.com>
Fri, 3 Jan 2025 11:31:32 +0000 (12:31 +0100)
committerShannon Sterz <s.sterz@proxmox.com>
Fri, 3 Jan 2025 11:31:32 +0000 (12:31 +0100)
allow type complexity where neccessary. this avoid triggering the clippy
lint `type_complexity` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

12 files changed:
src/props/filter_function.rs
src/props/load_callback.rs
src/props/sorter_function.rs
src/props/submit_callback.rs
src/state/data_store.rs
src/touch/material_app.rs
src/widget/data_table/cell_render_callback.rs
src/widget/data_table/header_render_callback.rs
src/widget/data_table/row_render_callback.rs
src/widget/form/submit_validate.rs
src/widget/form/validate.rs
src/widget/search_dropdown.rs

index d47e0fb6b34da40dd5ae2616877645cadea223ec..a8f47b013443bd087d621a3a699a84d9d536bd00 100644 (file)
@@ -59,7 +59,9 @@ impl<T, F: 'static + Fn(&T) -> bool> IntoFilterFn<T> for F {
 #[derive(Derivative)]
 #[derivative(Clone(bound = ""), PartialEq(bound = ""))]
 pub struct TextFilterFn<T>(
-    #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))] Rc<dyn Fn(&T, &str) -> bool>,
+    #[allow(clippy::type_complexity)]
+    #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))]
+    Rc<dyn Fn(&T, &str) -> bool>,
 );
 
 impl<T> TextFilterFn<T> {
index 180b02158df14dab84c8caf44b2c2d903de20f7e..bd28da944931b6c287b114208227800739461883 100644 (file)
@@ -26,6 +26,7 @@ use yew::AttrValue;
 /// [LoadCallback]. You can use that to trigger atomatic reloads on
 /// change.
 pub struct LoadCallback<T> {
+    #[allow(clippy::type_complexity)]
     callback: Rc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<T, Error>>>>>,
     url: Option<AttrValue>, // only used for change tracking
 }
@@ -160,6 +161,7 @@ impl<T, I: Into<LoadCallback<T>>> IntoLoadCallback<T> for Option<I> {
 }
 
 thread_local! {
+    #[allow(clippy::type_complexity)]
     static HTTP_GET: RefCell<Rc<dyn Send + Sync + Fn(String) -> Pin<Box<dyn Future<Output = Result<Value, Error>>>> >> = {
         RefCell::new(Rc::new(|url| Box::pin(http_get(url))))
     };
index 0f88338a07ce4e36bfb6e0224d8e48c1d46b9712..d30761e33f4b9f0bec5423c05514249dbc4d53fc 100644 (file)
@@ -9,7 +9,9 @@ use derivative::Derivative;
 #[derive(Derivative)]
 #[derivative(Clone(bound = ""), PartialEq(bound = ""))]
 pub struct SorterFn<T>(
-    #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))] Rc<dyn Fn(&T, &T) -> Ordering>,
+    #[allow(clippy::type_complexity)]
+    #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))]
+    Rc<dyn Fn(&T, &T) -> Ordering>,
 );
 
 impl<T> SorterFn<T> {
index 474c90324bd5115b34de3bfb4339c34172bce38e..14e93ce145223fa9fd32f1b9ef5b3cd461adef65 100644 (file)
@@ -11,6 +11,7 @@ use derivative::Derivative;
 #[derive(Derivative)]
 #[derivative(Clone, PartialEq)]
 pub struct SubmitCallback<T>(
+    #[allow(clippy::type_complexity)]
     #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))]
     Rc<dyn Fn(T) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>>,
 );
index c5b16a31e6963e462f8f76579e311a589891a56b..eff890d8361ed69dcd27656832cde932eb3da17a 100644 (file)
@@ -64,9 +64,12 @@ pub trait DataStore: Clone + PartialEq {
     fn filtered_record_pos(&self, key: &Key) -> Option<usize>;
     fn filtered_data_len(&self) -> usize;
 
+    #[allow(clippy::type_complexity)]
     fn filtered_data<'a>(
         &'a self,
     ) -> Box<dyn Iterator<Item = (usize, Box<dyn DataNode<Self::Record> + 'a>)> + 'a>;
+
+    #[allow(clippy::type_complexity)]
     fn filtered_data_range<'a>(
         &'a self,
         range: Range<usize>,
index d39bc9ab6464b20d3ae70ee24e384c44987a0b10..b2600795cafc2593170d9af65fa330484f399486 100644 (file)
@@ -410,7 +410,9 @@ impl From<MaterialApp> for VNode {
 #[derive(Derivative)]
 #[derivative(Clone(bound = ""), PartialEq(bound = ""))]
 pub struct PageRenderFn(
-    #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))] Rc<dyn Fn(&str) -> Vec<Html>>,
+    #[allow(clippy::type_complexity)]
+    #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))]
+    Rc<dyn Fn(&str) -> Vec<Html>>,
 );
 
 impl PageRenderFn {
index 2b38ebc5b37061de99169d3cc561a0c80708f15a..424ede5ca884fc21f7c745ff2773360ea5a7f371 100644 (file)
@@ -110,6 +110,7 @@ impl<T> DataTableCellRenderArgs<'_, T> {
 #[derive(Derivative)]
 #[derivative(Clone(bound = ""), PartialEq(bound = ""))]
 pub struct DataTableCellRenderer<T>(
+    #[allow(clippy::type_complexity)]
     #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))]
     Rc<dyn Fn(&mut DataTableCellRenderArgs<T>) -> Html>,
 );
index b5be17d6287f469bb1a5d7f8a1479c871bac9133..14143a465b1c1bd2e6271a0de040c105a2b10e95 100644 (file)
@@ -79,6 +79,7 @@ impl<T: 'static> DataTableHeaderRenderArgs<T> {
 #[derive(Derivative)]
 #[derivative(Clone(bound = ""), PartialEq(bound = ""))]
 pub struct DataTableHeaderRenderer<T: 'static>(
+    #[allow(clippy::type_complexity)]
     #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))]
     Rc<dyn Fn(&mut DataTableHeaderRenderArgs<T>) -> Html>,
 );
index f9ddaece3c9aeb4d2f4a085c37953ec311488933..66a090c412b1c444e4e41356f660174d279432b8 100644 (file)
@@ -75,6 +75,7 @@ impl<T> DataTableRowRenderArgs<'_, T> {
 #[derive(Derivative)]
 #[derivative(Clone(bound = ""), PartialEq(bound = ""))]
 pub struct DataTableRowRenderCallback<T>(
+    #[allow(clippy::type_complexity)]
     #[derivative(PartialEq(compare_with = "Rc::ptr_eq"))]
     Rc<dyn Fn(&mut DataTableRowRenderArgs<T>)>,
 );
index e60be7579a318922bfad8b33cc223b3ee8dda8a9..bed1353155618bd75337af5168359522a14e1561 100644 (file)
@@ -7,6 +7,7 @@ use serde_json::Value;
 /// passed record is valid, and return the value to be submitted.
 ///
 /// Wraps `Rc` around `Fn` so it can be passed as a prop.
+#[allow(clippy::type_complexity)]
 pub struct SubmitValidateFn<T>(Rc<dyn Fn(&T) -> Result<Value, Error>>);
 
 impl<T> Clone for SubmitValidateFn<T> {
index 9d7c46e6d37a9a9a8bf45a218e6400817009ad3d..61f08affa81f51001cadd9422ca6e3a7eab3e941 100644 (file)
@@ -6,6 +6,7 @@ use anyhow::Error;
 /// passed record is valid.
 ///
 /// Wraps `Rc` around `Fn` so it can be passed as a prop.
+#[allow(clippy::type_complexity)]
 pub struct ValidateFn<T>(Rc<dyn Fn(&T) -> Result<(), Error>>);
 
 /// Create a thread_local, static validation function.
index af0c5a687a66c969fa11950d38fa65f0eb9d9eb5..f9f0d760f2f3c1d2fc568edd393632d72d346679 100644 (file)
@@ -45,6 +45,7 @@ impl<S: DataStore + 'static> SearchDropdownRenderArgs<S> {
 /// The callback gets called with the current value of the dropdown input, and
 /// should return the filtered data.
 pub struct FilteredLoadCallback<T> {
+    #[allow(clippy::type_complexity)]
     callback: Rc<dyn Fn(String) -> Pin<Box<dyn Future<Output = Result<T, Error>>>>>,
 }