Skip to content

Commit 3e79741

Browse files
authored
Merge pull request #589 from xrelkd/feat/toolchain
Replace `lazy-static` with `std::sync::LazyLock`
2 parents 8b2530d + cbbe0ba commit 3e79741

34 files changed

Lines changed: 116 additions & 126 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ coherence_leak_check = "deny"
7474
confusable_idents = "deny"
7575
const_evaluatable_unchecked = "deny"
7676
const_item_mutation = "deny"
77+
dangling_pointers_from_temporaries = "deny"
7778
dead_code = "deny"
7879
deprecated = "deny"
7980
deprecated_where_clause_location = "deny"
@@ -130,13 +131,11 @@ semicolon_in_expressions_from_macros = "deny"
130131
special_module_name = "deny"
131132
stable_features = "deny"
132133
suspicious_double_ref_op = "deny"
133-
temporary_cstring_as_ptr = "deny"
134134
trivial_bounds = "deny"
135135
type_alias_bounds = "deny"
136136
tyvar_behind_raw_pointer = "deny"
137137
uncommon_codepoints = "deny"
138138
unconditional_recursion = "deny"
139-
undefined_naked_function_abi = "deny"
140139
unexpected_cfgs = "deny"
141140
ungated_async_fn_track_caller = "deny"
142141
uninhabited_static = "deny"

caracal-daemon/src/cli/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ mod tests {
115115

116116
#[test]
117117
fn test_command_simple() {
118-
if let Some(Commands::Version { .. }) =
119-
Cli::parse_from(["program_name", "version"]).commands
118+
if matches!(Cli::parse_from(["program_name", "version"]).commands, Some(Commands::Version))
120119
{
121120
// everything is good.
122121
} else {

caracal-tui/src/cli/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Default for Cli {
4848
}
4949

5050
impl Cli {
51-
#[allow(clippy::too_many_lines)]
51+
#[allow(clippy::result_large_err, clippy::too_many_lines)]
5252
pub fn run(self) -> Result<(), Error> {
5353
let Self { commands, log_level, config_file } = self;
5454

@@ -105,8 +105,7 @@ mod tests {
105105

106106
#[test]
107107
fn test_command_simple() {
108-
if let Some(Commands::Version { .. }) =
109-
Cli::parse_from(["program_name", "version"]).commands
108+
if matches!(Cli::parse_from(["program_name", "version"]).commands, Some(Commands::Version))
110109
{
111110
// everything is good.
112111
} else {

caracal-tui/src/tui/state_store/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ impl State {
4141

4242
pub fn mark_disconnected(&mut self) { self.daemon_version = None; }
4343

44-
pub fn tick_timer(&mut self) { self.timer += 1; }
44+
pub const fn tick_timer(&mut self) { self.timer += 1; }
4545
}

caracal-tui/src/tui/state_store/state_store.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ impl StateStore {
2727
(Self { state_tx, server_endpoint, access_token }, state_rx)
2828
}
2929

30+
#[allow(clippy::cognitive_complexity)]
3031
pub async fn serve(
3132
self,
3233
mut action_rx: mpsc::UnboundedReceiver<Action>,

caracal-tui/src/tui/ui/components/component.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ pub trait Component {
1212
where
1313
Self: Sized;
1414

15+
// FIXME: Use this method or remove it.
16+
#[allow(dead_code)]
1517
fn name(&self) -> &str;
1618

1719
fn handle_key_event(&mut self, key: KeyEvent);

caracal-tui/src/tui/ui/pages/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ pub struct AppRouter {
2828
}
2929

3030
impl AppRouter {
31+
// FIXME: Use this method or remove it.
32+
#[allow(dead_code)]
3133
fn get_active_page_component(&self) -> &dyn Component {
3234
match self.props.active_page {
3335
ActivePage::StatusPage => &self.status_page,

caracal-tui/src/tui/ui/pages/status/components/information.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl Component for InformationArea {
4242
Self { props: Props::from(state) }
4343
}
4444

45-
fn name(&self) -> &str { "Information" }
45+
fn name(&self) -> &'static str { "Information" }
4646

4747
fn handle_key_event(&mut self, _key: KeyEvent) {}
4848
}

caracal-tui/src/tui/ui/pages/status/components/task_status.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl Component for TaskStatusList {
8888
Self { props: Props::from(state), ..self }
8989
}
9090

91-
fn name(&self) -> &str { "Task Status List" }
91+
fn name(&self) -> &'static str { "Task Status List" }
9292

9393
fn handle_key_event(&mut self, key: KeyEvent) {
9494
if key.kind != KeyEventKind::Press {
@@ -206,7 +206,7 @@ impl ComponentRender<RenderProps> for TaskStatusList {
206206
Cell::from(status.file_path.file_name().unwrap_or_default().to_string_lossy()),
207207
Cell::new(humansize::format_size(total_bytes, humansize::BINARY)),
208208
Cell::new(humansize::format_size(
209-
if received_bytes >= total_bytes { 0 } else { total_bytes - received_bytes },
209+
total_bytes.saturating_sub(received_bytes),
210210
humansize::BINARY,
211211
)),
212212
Cell::new(progress_percentage),

0 commit comments

Comments
 (0)