Skip to content

Commit d0d996d

Browse files
committedMay 19, 2024··
fix: fix lints and errors
1 parent 3791bb0 commit d0d996d

File tree

15 files changed

+17
-45
lines changed

15 files changed

+17
-45
lines changed
 

‎Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ coherence_leak_check = "deny"
8080
confusable_idents = "deny"
8181
const_evaluatable_unchecked = "deny"
8282
const_item_mutation = "deny"
83-
const_patterns_without_partial_eq = "deny"
8483
dead_code = "deny"
8584
deprecated = "deny"
8685
deprecated_where_clause_location = "deny"
@@ -100,7 +99,6 @@ forgetting_references = "deny"
10099
for_loops_over_fallibles = "deny"
101100
function_item_references = "deny"
102101
hidden_glob_reexports = "deny"
103-
illegal_floating_point_literal_pattern = "deny"
104102
improper_ctypes = "deny"
105103
improper_ctypes_definitions = "deny"
106104
incomplete_features = "deny"
@@ -119,7 +117,6 @@ legacy_derive_helpers = "deny"
119117
map_unit_fn = "deny"
120118
mixed_script_confusables = "deny"
121119
named_arguments_used_positionally = "deny"
122-
nontrivial_structural_match = "deny"
123120
non_camel_case_types = "deny"
124121
non_fmt_panics = "deny"
125122
non_shorthand_field_patterns = "deny"
@@ -134,12 +131,10 @@ private_bounds = "deny"
134131
private_interfaces = "deny"
135132
redundant_semicolons = "deny"
136133
refining_impl_trait = "deny"
137-
renamed_and_removed_lints = "deny"
138134
repr_transparent_external_private_fields = "deny"
139135
semicolon_in_expressions_from_macros = "deny"
140136
special_module_name = "deny"
141137
stable_features = "deny"
142-
suspicious_auto_trait_impls = "deny"
143138
suspicious_double_ref_op = "deny"
144139
temporary_cstring_as_ptr = "deny"
145140
trivial_bounds = "deny"

‎clipcat-menu/src/finder/external/choose.rs

-4
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ impl FinderStream for Choose {
5656
.collect()
5757
}
5858

59-
fn line_length(&self) -> Option<usize> { Some(self.line_length) }
60-
61-
fn menu_length(&self) -> Option<usize> { Some(self.menu_length) }
62-
6359
fn set_line_length(&mut self, line_length: usize) { self.line_length = line_length }
6460

6561
fn set_menu_length(&mut self, menu_length: usize) { self.menu_length = menu_length; }

‎clipcat-menu/src/finder/external/dmenu.rs

-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ impl ExternalProgram for Dmenu {
3030
}
3131

3232
impl FinderStream for Dmenu {
33-
fn line_length(&self) -> Option<usize> { Some(self.line_length) }
34-
35-
fn menu_length(&self) -> Option<usize> { Some(self.menu_length) }
36-
3733
fn set_line_length(&mut self, line_length: usize) { self.line_length = line_length }
3834

3935
fn set_menu_length(&mut self, menu_length: usize) { self.menu_length = menu_length; }

‎clipcat-menu/src/finder/external/rofi.rs

-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ impl FinderStream for Rofi {
6161
.collect()
6262
}
6363

64-
fn line_length(&self) -> Option<usize> { Some(self.line_length) }
65-
66-
fn menu_length(&self) -> Option<usize> { Some(self.menu_length) }
67-
6864
fn set_line_length(&mut self, line_length: usize) { self.line_length = line_length }
6965

7066
fn set_menu_length(&mut self, menu_length: usize) { self.menu_length = menu_length; }

‎clipcat-menu/src/finder/finder_stream.rs

-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ pub trait FinderStream: Send + Sync {
3232
fn set_line_length(&mut self, _line_length: usize) {}
3333

3434
fn set_menu_length(&mut self, _menu_length: usize) {}
35-
36-
fn menu_length(&self) -> Option<usize> { None }
37-
38-
fn line_length(&self) -> Option<usize> { None }
3935
}
4036

4137
#[cfg(test)]

‎clipcatd/src/command.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Cli {
113113
config.daemonize = !self.no_daemon;
114114

115115
if let Some(history_file_path) = &self.history_file_path {
116-
config.history_file_path = history_file_path.clone();
116+
config.history_file_path.clone_from(history_file_path);
117117
}
118118

119119
if let Some(host) = self.grpc_host {
@@ -127,7 +127,7 @@ impl Cli {
127127

128128
if let Some(path) = &self.grpc_socket_path {
129129
config.grpc.enable_local_socket = true;
130-
config.grpc.local_socket = path.clone();
130+
config.grpc.local_socket.clone_from(path);
131131
}
132132

133133
if !config.grpc.enable_http && !config.grpc.enable_local_socket {

‎crates/base/src/kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl From<usize> for Kind {
8484
}
8585

8686
impl fmt::Display for Kind {
87-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) }
87+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) }
8888
}
8989

9090
#[derive(Debug, Snafu)]

‎crates/base/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ pub fn fallback_project_config_directories() -> Vec<PathBuf> {
8282
return Vec::new();
8383
};
8484
vec![
85-
[user_dirs.home_dir(), &Path::new(".config"), &Path::new(PROJECT_NAME)].iter().collect(),
86-
[user_dirs.home_dir(), &Path::new(&format!(".{PROJECT_NAME}"))].iter().collect(),
85+
[user_dirs.home_dir(), Path::new(".config"), Path::new(PROJECT_NAME)].iter().collect(),
86+
[user_dirs.home_dir(), Path::new(&format!(".{PROJECT_NAME}"))].iter().collect(),
8787
]
8888
}
8989

‎crates/clipboard/src/listener/x11/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl Context {
8282
.context(error::ReplySnafu)?;
8383

8484
if !xfixes.present {
85-
return Err(error::Error::XfixesNotPresent);
85+
return Err(Error::XfixesNotPresent);
8686
}
8787

8888
drop(self.connection.set_selection_owner(
@@ -133,7 +133,7 @@ impl Context {
133133
while Instant::now() < timeout_end {
134134
let maybe_event = self.connection.poll_for_event().context(error::PollForEventSnafu)?;
135135
let Some(event) = maybe_event else {
136-
thread::sleep(std::time::Duration::from_millis(1));
136+
thread::sleep(Duration::from_millis(1));
137137
continue;
138138
};
139139

‎crates/clipboard/src/listener/x11/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ fn try_reconnect(
200200
n = interval.as_millis(),
201201
kind = context.clipboard_kind()
202202
);
203-
std::thread::sleep(interval);
203+
thread::sleep(interval);
204204
} else {
205205
poll.registry()
206206
.register(

‎crates/server/src/history/driver/fs/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,14 @@ fn header_file_path<P>(file_path: P) -> PathBuf
307307
where
308308
P: AsRef<Path>,
309309
{
310-
[file_path.as_ref(), &Path::new("header.json")].into_iter().collect()
310+
[file_path.as_ref(), Path::new("header.json")].into_iter().collect()
311311
}
312312

313313
fn clips_file_path<P>(file_path: P) -> PathBuf
314314
where
315315
P: AsRef<Path>,
316316
{
317-
[file_path.as_ref(), &Path::new("clips")].into_iter().collect()
317+
[file_path.as_ref(), Path::new("clips")].into_iter().collect()
318318
}
319319

320320
fn image_dir_path<P>(file_path: P) -> PathBuf

‎crates/server/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,7 @@ async fn serve_worker(
533533
if synchronize_selection_with_clipboard
534534
&& clip.kind() == ClipboardKind::Clipboard
535535
{
536-
if let Err(err) =
537-
clipboard_manager.mark(id, clipcat_base::ClipboardKind::Primary).await
538-
{
536+
if let Err(err) = clipboard_manager.mark(id, ClipboardKind::Primary).await {
539537
tracing::warn!("{err}");
540538
}
541539
}

‎crates/server/src/metrics/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ impl Metrics {
1515

1616
// gRPC
1717
registry
18-
.register(Box::new(self::grpc::REQUESTS_TOTAL.clone()))
18+
.register(Box::new(grpc::REQUESTS_TOTAL.clone()))
1919
.context(error::SetupMetricsSnafu)?;
2020

2121
// D-Bus
2222
registry
23-
.register(Box::new(self::dbus::REQUESTS_TOTAL.clone()))
23+
.register(Box::new(dbus::REQUESTS_TOTAL.clone()))
2424
.context(error::SetupMetricsSnafu)?;
2525
registry
26-
.register(Box::new(self::dbus::REQUEST_DURATION_SECONDS.clone()))
26+
.register(Box::new(dbus::REQUEST_DURATION_SECONDS.clone()))
2727
.context(error::SetupMetricsSnafu)?;
2828

2929
Ok(Self { registry })

‎crates/server/src/snippets/event_handler.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ where
9898
return None;
9999
}
100100

101-
clipcat_base::ClipEntry::new(
102-
&data,
103-
&mime::TEXT_PLAIN_UTF_8,
104-
clipcat_base::ClipboardKind::Clipboard,
105-
None,
106-
)
107-
.ok()
101+
ClipEntry::new(&data, &mime::TEXT_PLAIN_UTF_8, clipcat_base::ClipboardKind::Clipboard, None)
102+
.ok()
108103
}

‎crates/server/src/snippets/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async fn load(config: &config::SnippetConfig) -> HashMap<ClipEntry, Option<PathB
6565
return None;
6666
}
6767

68-
clipcat_base::ClipEntry::new(
68+
ClipEntry::new(
6969
&data,
7070
&mime::TEXT_PLAIN_UTF_8,
7171
clipcat_base::ClipboardKind::Clipboard,

0 commit comments

Comments
 (0)
Please sign in to comment.