mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-04-19 19:34:24 +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
|
||||
});
|
||||
|
||||
Bar {
|
||||
Self {
|
||||
name,
|
||||
monitor_name,
|
||||
position,
|
||||
|
@ -131,7 +131,9 @@ impl Bar {
|
|||
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 {
|
||||
let hotspot_window = Window::new(WindowType::Toplevel);
|
||||
|
|
|
@ -208,10 +208,10 @@ impl Client {
|
|||
|
||||
impl WorkspaceClient for Client {
|
||||
fn focus(&self, id: String) -> Result<()> {
|
||||
let identifier = match id.parse::<i32>() {
|
||||
Ok(inum) => WorkspaceIdentifierWithSpecial::Id(inum),
|
||||
Err(_) => WorkspaceIdentifierWithSpecial::Name(&id),
|
||||
};
|
||||
let identifier = id.parse::<i32>().map_or_else(
|
||||
|_| WorkspaceIdentifierWithSpecial::Name(&id),
|
||||
WorkspaceIdentifierWithSpecial::Id,
|
||||
);
|
||||
|
||||
Dispatch::call(DispatchType::Workspace(identifier))?;
|
||||
Ok(())
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// It is necessary to store macros in a separate file due to a compilation error.
|
||||
/// I believe this stems from the feature flags.
|
||||
/// Related issue: <https://github.com/rust-lang/rust/issues/81066>
|
||||
//! It is necessary to store macros in a separate file due to a compilation error.
|
||||
//! I believe this stems from the feature flags.
|
||||
//! Related issue: <https://github.com/rust-lang/rust/issues/81066>
|
||||
|
||||
// --- 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> {
|
||||
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)| {
|
||||
desktop_file
|
||||
.get("Name")
|
||||
.map(|names| names.iter().any(|name| name.eq_ignore_ascii_case(app_id)))
|
||||
.unwrap_or_default()
|
||||
.is_some_and(|names| names.iter().any(|name| name.eq_ignore_ascii_case(app_id)))
|
||||
})
|
||||
// second pass - check name key for substring
|
||||
.or_else(|| {
|
||||
files.iter().find(|(_, desktop_file)| {
|
||||
desktop_file
|
||||
.get("Name")
|
||||
.map(|names| {
|
||||
names
|
||||
.iter()
|
||||
.any(|name| name.to_lowercase().contains(app_id))
|
||||
})
|
||||
.unwrap_or_default()
|
||||
desktop_file.get("Name").is_some_and(|names| {
|
||||
names
|
||||
.iter()
|
||||
.any(|name| name.to_lowercase().contains(app_id))
|
||||
})
|
||||
})
|
||||
})
|
||||
// third pass - check all keys for substring
|
||||
|
|
|
@ -60,7 +60,7 @@ impl DynamicBool {
|
|||
let mut rx = crate::write_lock!(variable_manager).subscribe(variable_name);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ impl Ironbar {
|
|||
OutputEventType::New => {
|
||||
match load_output_bars(&instance, &app, event.output) {
|
||||
Ok(mut new_bars) => {
|
||||
instance.bars.borrow_mut().append(&mut new_bars)
|
||||
instance.bars.borrow_mut().append(&mut new_bars);
|
||||
}
|
||||
Err(err) => error!("{err:?}"),
|
||||
}
|
||||
|
@ -326,7 +326,9 @@ fn load_output_bars(
|
|||
let display = get_display();
|
||||
|
||||
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 =
|
||||
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 {
|
||||
Ok(event) if matches!(event.kind, EventKind::Modify(ModifyKind::Data(_))) => {
|
||||
debug!("{event:?}");
|
||||
if event
|
||||
.paths
|
||||
.first()
|
||||
.map(|p| p == &style_path2)
|
||||
.unwrap_or_default()
|
||||
{
|
||||
if event.paths.first().is_some_and(|p| p == &style_path2) {
|
||||
try_send!(tx, style_path2.clone());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue