Skip to content

Commit f8cd562

Browse files
committed
style: lint warning killing spree
Got annoying to search for the important error messages in a jungle of rustc and clippy warnings
1 parent 742a0cc commit f8cd562

File tree

14 files changed

+59
-36
lines changed

14 files changed

+59
-36
lines changed

.harper-dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
focusable
2+
TODO

core/src/config/style.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl ContainerStyle {
138138
mod clap_parse {
139139
use iced::{Color, Padding};
140140

141-
use crate::config::style::{ColorDescriptor, StyleOverride};
141+
use crate::config::style::ColorDescriptor;
142142

143143
pub fn padding(value: &str) -> anyhow::Result<Padding> {
144144
let vec: Vec<f32> = value
@@ -160,7 +160,7 @@ mod clap_parse {
160160
pub fn color(value: &str) -> Result<ColorDescriptor, csscolorparser::ParseColorError> {
161161
Ok(match value.strip_prefix('$') {
162162
Some(name) => ColorDescriptor::ThemeColor(name.to_string()),
163-
None => ColorDescriptor::Color(Color::from(csscolorparser::parse(&value)?.to_array())),
163+
None => ColorDescriptor::Color(Color::from(csscolorparser::parse(value)?.to_array())),
164164
})
165165
}
166166
}

core/src/daemon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ async fn handle_client(mut stream: UnixStream, mut sender: Sender<Message>) -> a
9797
}
9898

9999
pub fn exit_cleanup(socket_path: &Path, pid_path: &Path) {
100-
if let Err(e) = fs::remove_file(&socket_path) {
100+
if let Err(e) = fs::remove_file(socket_path) {
101101
error!("Could not remove socket file at {socket_path:?}: {e}");
102102
}
103-
if let Err(e) = fs::remove_file(&pid_path) {
103+
if let Err(e) = fs::remove_file(pid_path) {
104104
error!("Could not remove PID file at {pid_path:?}: {e}");
105105
}
106106
}

core/src/helpers/merge.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ where
1919
let opt_right = right.into_opt();
2020
if let Some(right) = opt_right {
2121
match opt_left {
22-
Some(left) => left.extend(right.into_iter()),
22+
Some(left) => left.extend(right),
2323
None => *left = AcceptOption::from_opt(Some(right)),
2424
}
2525
}

core/src/helpers/task_constructor.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@ use iced::Task;
44

55
use crate::message::Message;
66

7+
#[allow(clippy::type_complexity)]
78
/// Used to create a [Task] using a type [T] that is not in the scope. When the type [T] comes into
89
/// scope, the [TaskConstructor] can be build into a [Task].
910
pub struct TaskConstructor<T, M = Message> {
1011
constructors: Vec<Box<dyn FnOnce(&mut T) -> Task<M>>>,
1112
_phantom: PhantomData<(T, M)>,
1213
}
1314

15+
impl<T> Default for TaskConstructor<T> {
16+
fn default() -> Self {
17+
Self::new()
18+
}
19+
}
20+
1421
impl<T, M> TaskConstructor<T, M>
1522
where
1623
M: 'static,

core/src/ipc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub enum IpcRequest {
4040
#[derive(Subcommand, Debug, Deserialize, Serialize)]
4141
pub enum WindowRequest {
4242
/// Open a new window
43-
Open(WindowRuntimeOptions),
43+
Open(Box<WindowRuntimeOptions>),
4444
/// Close a window
4545
Close {
4646
#[arg(short = 'A', long)]

core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod message;
1111
pub mod module;
1212
pub mod registry;
1313
mod state;
14-
mod subscription;
14+
pub mod subscription;
1515
pub mod template_engine;
1616
pub mod window;
1717

core/src/message.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl Debug for UpdateFn {
2121
}
2222
}
2323

24+
#[allow(clippy::type_complexity)]
2425
/// Capturing closure that is executed with read access to [T]
2526
pub struct ReadFn<T>(Arc<Box<dyn FnOnce(&T) + Send + Sync>>);
2627
impl<T> Debug for ReadFn<T> {

core/src/module.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub trait Module: Downcast + Debug + Send + Sync {
1818
true
1919
}
2020

21-
fn view(&self, variant: &str, anchor: &Anchor, context: &Context) -> Element;
21+
fn view(&self, variant: &str, anchor: &Anchor, context: &Context) -> Element<'_>;
2222

2323
#[allow(unused_variables)]
2424
fn sources(&self, variant: &str) -> Vec<&String> {
@@ -57,10 +57,10 @@ mod dummy {
5757
}
5858
fn view(
5959
&self,
60-
variant: &str,
61-
anchor: &smithay_client_toolkit::shell::wlr_layer::Anchor,
62-
context: &super::Context,
63-
) -> Element {
60+
_variant: &str,
61+
_anchor: &smithay_client_toolkit::shell::wlr_layer::Anchor,
62+
_context: &super::Context,
63+
) -> Element<'_> {
6464
text!("This is a dummy module!").into()
6565
}
6666
}
@@ -82,9 +82,9 @@ mod custom {
8282
}
8383

8484
struct CustomModule {
85-
sources: Vec<String>,
85+
_sources: Vec<String>,
8686
style: ContainerStyle,
87-
config: Table,
87+
_config: Table,
8888
token: Box<dyn Token<Message> + Send + Sync>,
8989
}
9090

@@ -103,7 +103,7 @@ mod custom {
103103
variant: &str,
104104
anchor: &smithay_client_toolkit::shell::wlr_layer::Anchor,
105105
context: &super::Context,
106-
) -> Element {
106+
) -> Element<'_> {
107107
let Some(custom) = self.modules.get(variant) else {
108108
log::error!("Invalid variant name of custom module: {variant}");
109109
return "Invalid variant name".into();
@@ -127,10 +127,10 @@ mod custom {
127127
self.modules.insert(
128128
String::from(variant),
129129
CustomModule {
130-
sources: vec![],
130+
_sources: vec![],
131131
style,
132132
token: engine.render_token(format),
133-
config,
133+
_config: config,
134134
},
135135
);
136136
}

core/src/registry.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ impl Registry {
5252
self.try_get_module_mut().unwrap()
5353
}
5454

55-
pub fn get_modules<'a, I>(
55+
pub fn get_modules<'a, 'b, I>(
5656
&'a self,
5757
enabled: I,
58-
) -> impl Iterator<Item = (&'a String, &Box<dyn Module>)>
58+
) -> impl Iterator<Item = (&'b String, &'a Box<dyn Module>)>
5959
where
60-
I: Iterator<Item = &'a String>,
60+
I: Iterator<Item = &'b String>,
6161
{
6262
enabled.filter_map(|id| {
6363
self.module_names
@@ -103,6 +103,6 @@ impl Registry {
103103
}
104104

105105
pub fn module_names(&self) -> impl Iterator<Item = &String> {
106-
self.module_names.iter().map(|(name, _)| name)
106+
self.module_names.keys()
107107
}
108108
}

0 commit comments

Comments
 (0)