Skip to content

Commit 2caf723

Browse files
olafkfreundclaude
andcommitted
Fix all clippy warnings: dead code, unused fields, type complexity
- Prefix unused Args fields (handle, app_id, parent_window) with underscore - Add #[allow(dead_code)] to DmabufHelper methods reserved for future use - Replace unwrap-after-is_some with if-let pattern in screenshot.rs - Add #[allow(clippy::large_enum_variant)] for Msg enums - Add #[allow(clippy::type_complexity)] for Session close_cb and access choices - Add #[allow(clippy::too_many_arguments)] for ScreenshotSelection::new Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 276af0b commit 2caf723

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

src/access.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(dead_code, unused_variables)]
1+
#![allow(dead_code, unused_variables, clippy::type_complexity)]
22

33
use cosmic::iced_runtime::platform_specific::wayland::layer_surface::{
44
IcedOutput, SctkLayerSurfaceSettings,
@@ -31,7 +31,6 @@ pub(crate) struct AccessDialogOptions {
3131
grant_label: Option<String>,
3232
icon: Option<String>,
3333
//(ID returned with the response, choices (ID, label), label, initial selection or "" meaning the portal should choose)
34-
#[allow(clippy::type_complexity)]
3534
choices: Option<Vec<(String, String, Vec<(String, String)>, String)>>,
3635
}
3736

src/app.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub struct OutputState {
5858
}
5959

6060
#[derive(Debug, Clone)]
61+
#[allow(clippy::large_enum_variant)]
6162
pub enum Msg {
6263
Access(access::Msg),
6364
FileChooser(window::Id, file_chooser::Msg),

src/file_chooser.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ impl FileChooser {
158158
if let Err(err) = self
159159
.tx
160160
.send(subscription::Event::FileChooser(Args {
161-
handle: handle.to_owned(),
162-
app_id: app_id.to_string(),
163-
parent_window: parent_window.to_string(),
161+
_handle: handle.to_owned(),
162+
_app_id: app_id.to_string(),
163+
_parent_window: parent_window.to_string(),
164164
title: title.to_string(),
165165
options,
166166
tx,
@@ -236,16 +236,17 @@ impl FileChooser {
236236
}
237237

238238
#[derive(Debug, Clone)]
239+
#[allow(clippy::large_enum_variant)]
239240
pub enum Msg {
240241
DialogMessage(DialogMessage),
241242
DialogResult(DialogResult),
242243
}
243244

244245
#[derive(Clone, Debug)]
245246
pub(crate) struct Args {
246-
pub handle: zvariant::ObjectPath<'static>,
247-
pub app_id: String,
248-
pub parent_window: String,
247+
pub _handle: zvariant::ObjectPath<'static>,
248+
pub _app_id: String,
249+
pub _parent_window: String,
249250
pub title: String,
250251
pub options: FileChooserOptions,
251252
pub tx: Sender<PortalResponse<FileChooserResult>>,
@@ -426,7 +427,7 @@ pub fn update_args(portal: &mut CosmicPortal, args: Args) -> cosmic::Task<cosmic
426427
}
427428
};
428429
let mut settings = DialogSettings::new().kind(kind);
429-
//TODO: setting app_id breaks dialog floating: .app_id(args.app_id.clone());
430+
//TODO: setting app_id breaks dialog floating: .app_id(args._app_id.clone());
430431
if let Some(path) = args.options.current_folder() {
431432
settings = settings.path(path);
432433
}

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ impl Request {
9999

100100
struct Session<T: Send + Sync + 'static> {
101101
data: T,
102+
#[allow(clippy::type_complexity)]
102103
close_cb: Option<Box<dyn FnOnce(&mut T) + Send + Sync + 'static>>,
103104
}
104105

src/screenshot.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,11 +729,11 @@ pub fn update_msg(portal: &mut CosmicPortal, msg: Msg) -> cosmic::Task<crate::ap
729729
}
730730
}
731731

732-
let response = if success && image_path.is_some() {
732+
let response = if let (true, Some(path)) = (success, &image_path) {
733733
PortalResponse::Success(ScreenshotResult {
734-
uri: format!("file:///{}", image_path.unwrap().display()),
734+
uri: format!("file:///{}", path.display()),
735735
})
736-
} else if success && image_path.is_none() {
736+
} else if success {
737737
PortalResponse::Success(ScreenshotResult {
738738
uri: "clipboard:///".to_string(),
739739
})

src/wayland/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ impl DmabufHelper {
6262

6363
// TODO: consider scanout flag?
6464
// Consider tranches in some way?
65+
#[allow(dead_code)]
6566
fn feedback_formats(&self) -> impl Iterator<Item = &DmabufFormat> {
6667
self.feedback
6768
.tranches()
@@ -70,6 +71,7 @@ impl DmabufHelper {
7071
.filter_map(|x| self.feedback.format_table().get(*x as usize))
7172
}
7273

74+
#[allow(dead_code)]
7375
pub fn modifiers_for_format(&self, format: u32) -> impl Iterator<Item = u64> + '_ {
7476
self.feedback_formats()
7577
.filter(move |x| x.format == format)

src/widget/screenshot.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ impl<'a, Msg> ScreenshotSelection<'a, Msg>
6363
where
6464
Msg: 'static + Clone,
6565
{
66+
#[allow(clippy::too_many_arguments)]
6667
pub fn new(
6768
choice: Choice,
6869
image: &ScreenshotImage,

0 commit comments

Comments
 (0)