Skip to content

Commit

Permalink
fix: fix lints and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
xrelkd committed May 19, 2024
1 parent 3791bb0 commit 891beda
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 37 deletions.
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ coherence_leak_check = "deny"
confusable_idents = "deny"
const_evaluatable_unchecked = "deny"
const_item_mutation = "deny"
const_patterns_without_partial_eq = "deny"
dead_code = "deny"
deprecated = "deny"
deprecated_where_clause_location = "deny"
Expand All @@ -100,7 +99,6 @@ forgetting_references = "deny"
for_loops_over_fallibles = "deny"
function_item_references = "deny"
hidden_glob_reexports = "deny"
illegal_floating_point_literal_pattern = "deny"
improper_ctypes = "deny"
improper_ctypes_definitions = "deny"
incomplete_features = "deny"
Expand All @@ -119,7 +117,6 @@ legacy_derive_helpers = "deny"
map_unit_fn = "deny"
mixed_script_confusables = "deny"
named_arguments_used_positionally = "deny"
nontrivial_structural_match = "deny"
non_camel_case_types = "deny"
non_fmt_panics = "deny"
non_shorthand_field_patterns = "deny"
Expand All @@ -134,12 +131,10 @@ private_bounds = "deny"
private_interfaces = "deny"
redundant_semicolons = "deny"
refining_impl_trait = "deny"
renamed_and_removed_lints = "deny"
repr_transparent_external_private_fields = "deny"
semicolon_in_expressions_from_macros = "deny"
special_module_name = "deny"
stable_features = "deny"
suspicious_auto_trait_impls = "deny"
suspicious_double_ref_op = "deny"
temporary_cstring_as_ptr = "deny"
trivial_bounds = "deny"
Expand Down
4 changes: 0 additions & 4 deletions clipcat-menu/src/finder/external/choose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ impl FinderStream for Choose {
.collect()
}

fn line_length(&self) -> Option<usize> { Some(self.line_length) }

fn menu_length(&self) -> Option<usize> { Some(self.menu_length) }

fn set_line_length(&mut self, line_length: usize) { self.line_length = line_length }

fn set_menu_length(&mut self, menu_length: usize) { self.menu_length = menu_length; }
Expand Down
4 changes: 0 additions & 4 deletions clipcat-menu/src/finder/external/dmenu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ impl ExternalProgram for Dmenu {
}

impl FinderStream for Dmenu {
fn line_length(&self) -> Option<usize> { Some(self.line_length) }

fn menu_length(&self) -> Option<usize> { Some(self.menu_length) }

fn set_line_length(&mut self, line_length: usize) { self.line_length = line_length }

fn set_menu_length(&mut self, menu_length: usize) { self.menu_length = menu_length; }
Expand Down
4 changes: 0 additions & 4 deletions clipcat-menu/src/finder/external/rofi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ impl FinderStream for Rofi {
.collect()
}

fn line_length(&self) -> Option<usize> { Some(self.line_length) }

fn menu_length(&self) -> Option<usize> { Some(self.menu_length) }

fn set_line_length(&mut self, line_length: usize) { self.line_length = line_length }

fn set_menu_length(&mut self, menu_length: usize) { self.menu_length = menu_length; }
Expand Down
4 changes: 0 additions & 4 deletions clipcat-menu/src/finder/finder_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ pub trait FinderStream: Send + Sync {
fn set_line_length(&mut self, _line_length: usize) {}

fn set_menu_length(&mut self, _menu_length: usize) {}

fn menu_length(&self) -> Option<usize> { None }

fn line_length(&self) -> Option<usize> { None }
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions clipcatd/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl Cli {
config.daemonize = !self.no_daemon;

if let Some(history_file_path) = &self.history_file_path {
config.history_file_path = history_file_path.clone();
config.history_file_path.clone_from(history_file_path);
}

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

if let Some(path) = &self.grpc_socket_path {
config.grpc.enable_local_socket = true;
config.grpc.local_socket = path.clone();
config.grpc.local_socket.clone_from(path);
}

if !config.grpc.enable_http && !config.grpc.enable_local_socket {
Expand Down
2 changes: 1 addition & 1 deletion crates/base/src/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl From<usize> for Kind {
}

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

#[derive(Debug, Snafu)]
Expand Down
4 changes: 2 additions & 2 deletions crates/base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ pub fn fallback_project_config_directories() -> Vec<PathBuf> {
return Vec::new();
};
vec![
[user_dirs.home_dir(), &Path::new(".config"), &Path::new(PROJECT_NAME)].iter().collect(),
[user_dirs.home_dir(), &Path::new(&format!(".{PROJECT_NAME}"))].iter().collect(),
[user_dirs.home_dir(), Path::new(".config"), Path::new(PROJECT_NAME)].iter().collect(),
[user_dirs.home_dir(), Path::new(&format!(".{PROJECT_NAME}"))].iter().collect(),
]
}

Expand Down
4 changes: 2 additions & 2 deletions crates/clipboard/src/listener/x11/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Context {
.context(error::ReplySnafu)?;

if !xfixes.present {
return Err(error::Error::XfixesNotPresent);
return Err(Error::XfixesNotPresent);
}

drop(self.connection.set_selection_owner(
Expand Down Expand Up @@ -133,7 +133,7 @@ impl Context {
while Instant::now() < timeout_end {
let maybe_event = self.connection.poll_for_event().context(error::PollForEventSnafu)?;
let Some(event) = maybe_event else {
thread::sleep(std::time::Duration::from_millis(1));
thread::sleep(Duration::from_millis(1));
continue;
};

Expand Down
2 changes: 1 addition & 1 deletion crates/clipboard/src/listener/x11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ fn try_reconnect(
n = interval.as_millis(),
kind = context.clipboard_kind()
);
std::thread::sleep(interval);
thread::sleep(interval);
} else {
poll.registry()
.register(
Expand Down
4 changes: 2 additions & 2 deletions crates/server/src/history/driver/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,14 @@ fn header_file_path<P>(file_path: P) -> PathBuf
where
P: AsRef<Path>,
{
[file_path.as_ref(), &Path::new("header.json")].into_iter().collect()
[file_path.as_ref(), Path::new("header.json")].into_iter().collect()
}

fn clips_file_path<P>(file_path: P) -> PathBuf
where
P: AsRef<Path>,
{
[file_path.as_ref(), &Path::new("clips")].into_iter().collect()
[file_path.as_ref(), Path::new("clips")].into_iter().collect()
}

fn image_dir_path<P>(file_path: P) -> PathBuf
Expand Down
2 changes: 1 addition & 1 deletion crates/server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ async fn serve_worker(
&& clip.kind() == ClipboardKind::Clipboard
{
if let Err(err) =
clipboard_manager.mark(id, clipcat_base::ClipboardKind::Primary).await
clipboard_manager.mark(id, ClipboardKind::Primary).await
{
tracing::warn!("{err}");
}
Expand Down
6 changes: 3 additions & 3 deletions crates/server/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ impl Metrics {

// gRPC
registry
.register(Box::new(self::grpc::REQUESTS_TOTAL.clone()))
.register(Box::new(grpc::REQUESTS_TOTAL.clone()))
.context(error::SetupMetricsSnafu)?;

// D-Bus
registry
.register(Box::new(self::dbus::REQUESTS_TOTAL.clone()))
.register(Box::new(dbus::REQUESTS_TOTAL.clone()))
.context(error::SetupMetricsSnafu)?;
registry
.register(Box::new(self::dbus::REQUEST_DURATION_SECONDS.clone()))
.register(Box::new(dbus::REQUEST_DURATION_SECONDS.clone()))
.context(error::SetupMetricsSnafu)?;

Ok(Self { registry })
Expand Down
2 changes: 1 addition & 1 deletion crates/server/src/snippets/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
return None;
}

clipcat_base::ClipEntry::new(
ClipEntry::new(
&data,
&mime::TEXT_PLAIN_UTF_8,
clipcat_base::ClipboardKind::Clipboard,
Expand Down
2 changes: 1 addition & 1 deletion crates/server/src/snippets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async fn load(config: &config::SnippetConfig) -> HashMap<ClipEntry, Option<PathB
return None;
}

clipcat_base::ClipEntry::new(
ClipEntry::new(
&data,
&mime::TEXT_PLAIN_UTF_8,
clipcat_base::ClipboardKind::Clipboard,
Expand Down

0 comments on commit 891beda

Please sign in to comment.