mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 18:51:04 +02:00
Merge pull request #433 from JakeStanger/refactor/clippy
refactor: fix new strict clippy warnings
This commit is contained in:
commit
4934f2c409
8 changed files with 24 additions and 29 deletions
|
@ -93,7 +93,7 @@ impl Bar {
|
||||||
Propagation::Proceed
|
Propagation::Proceed
|
||||||
});
|
});
|
||||||
|
|
||||||
Bar {
|
Self {
|
||||||
name,
|
name,
|
||||||
monitor_name,
|
monitor_name,
|
||||||
position,
|
position,
|
||||||
|
@ -131,7 +131,9 @@ impl Bar {
|
||||||
monitor,
|
monitor,
|
||||||
);
|
);
|
||||||
|
|
||||||
let start_hidden = config.start_hidden.unwrap_or(config.autohide.is_some());
|
let start_hidden = config
|
||||||
|
.start_hidden
|
||||||
|
.unwrap_or_else(|| config.autohide.is_some());
|
||||||
|
|
||||||
if let Some(autohide) = config.autohide {
|
if let Some(autohide) = config.autohide {
|
||||||
let hotspot_window = Window::new(WindowType::Toplevel);
|
let hotspot_window = Window::new(WindowType::Toplevel);
|
||||||
|
|
|
@ -208,10 +208,10 @@ impl Client {
|
||||||
|
|
||||||
impl WorkspaceClient for Client {
|
impl WorkspaceClient for Client {
|
||||||
fn focus(&self, id: String) -> Result<()> {
|
fn focus(&self, id: String) -> Result<()> {
|
||||||
let identifier = match id.parse::<i32>() {
|
let identifier = id.parse::<i32>().map_or_else(
|
||||||
Ok(inum) => WorkspaceIdentifierWithSpecial::Id(inum),
|
|_| WorkspaceIdentifierWithSpecial::Name(&id),
|
||||||
Err(_) => WorkspaceIdentifierWithSpecial::Name(&id),
|
WorkspaceIdentifierWithSpecial::Id,
|
||||||
};
|
);
|
||||||
|
|
||||||
Dispatch::call(DispatchType::Workspace(identifier))?;
|
Dispatch::call(DispatchType::Workspace(identifier))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// It is necessary to store macros in a separate file due to a compilation error.
|
//! It is necessary to store macros in a separate file due to a compilation error.
|
||||||
/// I believe this stems from the feature flags.
|
//! I believe this stems from the feature flags.
|
||||||
/// Related issue: <https://github.com/rust-lang/rust/issues/81066>
|
//! Related issue: <https://github.com/rust-lang/rust/issues/81066>
|
||||||
|
|
||||||
// --- Data Control Device --- \\
|
// --- Data Control Device --- \\
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ struct BroadcastChannel<T>(broadcast::Sender<T>, Arc<Mutex<broadcast::Receiver<T
|
||||||
|
|
||||||
impl<T> From<(broadcast::Sender<T>, broadcast::Receiver<T>)> for BroadcastChannel<T> {
|
impl<T> From<(broadcast::Sender<T>, broadcast::Receiver<T>)> for BroadcastChannel<T> {
|
||||||
fn from(value: (broadcast::Sender<T>, broadcast::Receiver<T>)) -> Self {
|
fn from(value: (broadcast::Sender<T>, broadcast::Receiver<T>)) -> Self {
|
||||||
BroadcastChannel(value.0, arc_mut!(value.1))
|
Self(value.0, arc_mut!(value.1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,20 +123,16 @@ fn find_desktop_file_by_filedata(app_id: &str, files: &[PathBuf]) -> Option<Path
|
||||||
.find(|(_, desktop_file)| {
|
.find(|(_, desktop_file)| {
|
||||||
desktop_file
|
desktop_file
|
||||||
.get("Name")
|
.get("Name")
|
||||||
.map(|names| names.iter().any(|name| name.eq_ignore_ascii_case(app_id)))
|
.is_some_and(|names| names.iter().any(|name| name.eq_ignore_ascii_case(app_id)))
|
||||||
.unwrap_or_default()
|
|
||||||
})
|
})
|
||||||
// second pass - check name key for substring
|
// second pass - check name key for substring
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
files.iter().find(|(_, desktop_file)| {
|
files.iter().find(|(_, desktop_file)| {
|
||||||
desktop_file
|
desktop_file.get("Name").is_some_and(|names| {
|
||||||
.get("Name")
|
names
|
||||||
.map(|names| {
|
.iter()
|
||||||
names
|
.any(|name| name.to_lowercase().contains(app_id))
|
||||||
.iter()
|
})
|
||||||
.any(|name| name.to_lowercase().contains(app_id))
|
|
||||||
})
|
|
||||||
.unwrap_or_default()
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// third pass - check all keys for substring
|
// third pass - check all keys for substring
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl DynamicBool {
|
||||||
let mut rx = crate::write_lock!(variable_manager).subscribe(variable_name);
|
let mut rx = crate::write_lock!(variable_manager).subscribe(variable_name);
|
||||||
|
|
||||||
while let Ok(value) = rx.recv().await {
|
while let Ok(value) = rx.recv().await {
|
||||||
let has_value = value.map(|s| is_truthy(&s)).unwrap_or_default();
|
let has_value = value.is_some_and(|s| is_truthy(&s));
|
||||||
send_async!(tx, has_value);
|
send_async!(tx, has_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ impl Ironbar {
|
||||||
OutputEventType::New => {
|
OutputEventType::New => {
|
||||||
match load_output_bars(&instance, &app, event.output) {
|
match load_output_bars(&instance, &app, event.output) {
|
||||||
Ok(mut new_bars) => {
|
Ok(mut new_bars) => {
|
||||||
instance.bars.borrow_mut().append(&mut new_bars)
|
instance.bars.borrow_mut().append(&mut new_bars);
|
||||||
}
|
}
|
||||||
Err(err) => error!("{err:?}"),
|
Err(err) => error!("{err:?}"),
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,9 @@ fn load_output_bars(
|
||||||
let display = get_display();
|
let display = get_display();
|
||||||
|
|
||||||
let pos = output.logical_position.unwrap_or_default();
|
let pos = output.logical_position.unwrap_or_default();
|
||||||
let monitor = display.monitor_at_point(pos.0, pos.1).unwrap();
|
let monitor = display
|
||||||
|
.monitor_at_point(pos.0, pos.1)
|
||||||
|
.expect("monitor to exist");
|
||||||
|
|
||||||
let show_default_bar =
|
let show_default_bar =
|
||||||
config.start.is_some() || config.center.is_some() || config.end.is_some();
|
config.start.is_some() || config.center.is_some() || config.end.is_some();
|
||||||
|
|
|
@ -50,12 +50,7 @@ pub fn load_css(style_path: PathBuf) {
|
||||||
let mut watcher = recommended_watcher(move |res: Result<Event>| match res {
|
let mut watcher = recommended_watcher(move |res: Result<Event>| match res {
|
||||||
Ok(event) if matches!(event.kind, EventKind::Modify(ModifyKind::Data(_))) => {
|
Ok(event) if matches!(event.kind, EventKind::Modify(ModifyKind::Data(_))) => {
|
||||||
debug!("{event:?}");
|
debug!("{event:?}");
|
||||||
if event
|
if event.paths.first().is_some_and(|p| p == &style_path2) {
|
||||||
.paths
|
|
||||||
.first()
|
|
||||||
.map(|p| p == &style_path2)
|
|
||||||
.unwrap_or_default()
|
|
||||||
{
|
|
||||||
try_send!(tx, style_path2.clone());
|
try_send!(tx, style_path2.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue