From 62c8e4deda860929fea3781f11f4523a4600978b Mon Sep 17 00:00:00 2001 From: Luuk van der Duim Date: Sun, 3 Mar 2024 16:52:06 +0100 Subject: [PATCH 1/8] fix build instructions in README It is unnecessary to run `cargo build` before `cargo install`. On my machine this causes Odilia to be built twice, possibly because of different build profiles. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 7ddea335..220b9833 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ To build odilia, copy paste the following on your command line . The following s ```shell git clone https://github.com/odilia-app/odilia && \ cd odilia && \ -cargo build --release && \ cargo install --path odilia ``` From 0d49691c7a6a4783faea2a8769b2e869e184d5bc Mon Sep 17 00:00:00 2001 From: Luuk van der Duim Date: Sun, 3 Mar 2024 17:07:59 +0100 Subject: [PATCH 2/8] fix clippy warnings: 'multiple versions for dependencies' Various crates hit this lint, like so. ```console error: multiple versions for dependency `windows_x86_64_gnullvm`: 0.48.5, 0.52.3 | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions ``` There is often little we can do, other than perhaps be less strict in minor and oatchlevels on dependencies. This may give cargo more leeway to unite matching deps. --- cache/src/lib.rs | 1 + input/src/lib.rs | 1 + tts/src/lib.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/cache/src/lib.rs b/cache/src/lib.rs index cd6e38d3..a85e9ea2 100644 --- a/cache/src/lib.rs +++ b/cache/src/lib.rs @@ -6,6 +6,7 @@ clippy::unwrap_used, unsafe_code )] +#![allow(clippy::multiple_crate_versions)] use std::{ collections::HashMap, diff --git a/input/src/lib.rs b/input/src/lib.rs index 274d1c6b..5a753945 100644 --- a/input/src/lib.rs +++ b/input/src/lib.rs @@ -6,6 +6,7 @@ clippy::unwrap_used, unsafe_code )] +#![allow(clippy::multiple_crate_versions)] use eyre::Context; use nix::unistd::Uid; diff --git a/tts/src/lib.rs b/tts/src/lib.rs index a361b741..447366ad 100644 --- a/tts/src/lib.rs +++ b/tts/src/lib.rs @@ -6,6 +6,7 @@ clippy::unwrap_used, unsafe_code )] +#![allow(clippy::multiple_crate_versions)] use eyre::Context; use ssip_client_async::{ From c2343d867873fd940d8ea7cf8755748fc07ae196 Mon Sep 17 00:00:00 2001 From: Luuk van der Duim Date: Sun, 3 Mar 2024 17:18:08 +0100 Subject: [PATCH 3/8] fixup unused variable with underscore at wrong end Rust-analyzer points out that the undersore is at the wrong end, it should be in front of the variable: `_unused` not `unused_`. --- cache/benches/load_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cache/benches/load_test.rs b/cache/benches/load_test.rs index 0c497001..8ae28a01 100644 --- a/cache/benches/load_test.rs +++ b/cache/benches/load_test.rs @@ -43,8 +43,8 @@ async fn traverse_up_refs(children: Vec>>) { loop { let item_ref_copy = Arc::clone(&item_ref); let mut item = item_ref_copy.write().expect("Could not lock item"); - let root_ = ROOT_A11Y.clone(); - if matches!(&item.object.id, root_) { + let _root = ROOT_A11Y.clone(); + if matches!(&item.object.id, _root) { break; } item_ref = item.parent_ref().expect("Could not get parent reference"); From 63ae5a4ec18f81370ca82265254e38aa46187de3 Mon Sep 17 00:00:00 2001 From: Luuk van der Duim Date: Sun, 3 Mar 2024 17:23:12 +0100 Subject: [PATCH 4/8] remove unresolvable imports in load_test bench --- cache/benches/load_test.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/cache/benches/load_test.rs b/cache/benches/load_test.rs index 8ae28a01..ffa0bb3b 100644 --- a/cache/benches/load_test.rs +++ b/cache/benches/load_test.rs @@ -4,8 +4,6 @@ use std::{ time::Duration, }; -use atspi::accessible::Accessible; -use atspi_client::AccessibilityConnection; use criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion}; use odilia_cache::{AccessiblePrimitive, Cache, CacheItem}; From 4d6aac86001680cc3fc5b98ed96510c89c8c7589 Mon Sep 17 00:00:00 2001 From: Luuk van der Duim Date: Sun, 3 Mar 2024 17:25:26 +0100 Subject: [PATCH 5/8] Remove redundant imports --- common/src/types.rs | 2 +- odilia-notify/src/notification.rs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/common/src/types.rs b/common/src/types.rs index 4eddeb41..32a559db 100644 --- a/common/src/types.rs +++ b/common/src/types.rs @@ -1,5 +1,5 @@ use atspi_common::Granularity; -use serde::{self, Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use zbus::zvariant::OwnedObjectPath; pub type Accessible = (String, OwnedObjectPath); diff --git a/odilia-notify/src/notification.rs b/odilia-notify/src/notification.rs index 838cbce0..3dc918e0 100644 --- a/odilia-notify/src/notification.rs +++ b/odilia-notify/src/notification.rs @@ -25,8 +25,6 @@ impl TryFrom> for Notification { } #[cfg(test)] mod tests { - use zbus::names::UniqueName; - use super::*; #[test] fn correctly_formatted_message_leads_to_a_correct_notification() -> Result<(), zbus::Error> From b268b7744c0951da5a002ec650a901b7b0b89e9b Mon Sep 17 00:00:00 2001 From: Luuk van der Duim Date: Sun, 3 Mar 2024 23:34:06 +0100 Subject: [PATCH 6/8] Clippy: Immediately dereferenced reference. --- cache/benches/load_test.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cache/benches/load_test.rs b/cache/benches/load_test.rs index ffa0bb3b..b2a8e214 100644 --- a/cache/benches/load_test.rs +++ b/cache/benches/load_test.rs @@ -4,6 +4,8 @@ use std::{ time::Duration, }; +use atspi_connection::AccessibilityConnection; +use atspi_proxies::accessible::Accessible; use criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion}; use odilia_cache::{AccessiblePrimitive, Cache, CacheItem}; @@ -220,7 +222,7 @@ fn cache_benchmark(c: &mut Criterion) { b.to_async(&rt).iter_batched( || { children.iter() - .map(|am| Arc::clone(&am).read().unwrap().clone()) + .map(|am| Arc::clone(am).read().unwrap().clone()) .collect() }, |cs| async { traverse_up(cs).await }, From 27a032fc73e6a9e9f552ef8fd2e538f159ea60e4 Mon Sep 17 00:00:00 2001 From: Luuk van der Duim Date: Sun, 3 Mar 2024 23:36:55 +0100 Subject: [PATCH 7/8] Clippy: several cases of 'Return requires use' and 'unused variable' --- cache/benches/load_test.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cache/benches/load_test.rs b/cache/benches/load_test.rs index b2a8e214..41a0f966 100644 --- a/cache/benches/load_test.rs +++ b/cache/benches/load_test.rs @@ -23,13 +23,13 @@ macro_rules! load_items { /// This is different from `add` in that it postpones populating references /// until after all items have been added. fn add_all(cache: &Cache, items: Vec) { - cache.add_all(items); + let _ = cache.add_all(items); } /// Load the given items into cache via repeated `Cache::add`. fn add(cache: &Cache, items: Vec) { for item in items { - cache.add(item); + let _ = cache.add(item); } } @@ -43,7 +43,7 @@ async fn traverse_up_refs(children: Vec>>) { loop { let item_ref_copy = Arc::clone(&item_ref); let mut item = item_ref_copy.write().expect("Could not lock item"); - let _root = ROOT_A11Y.clone(); + let _root = ROOT_A11Y; if matches!(&item.object.id, _root) { break; } @@ -71,8 +71,8 @@ async fn traverse_up(children: Vec) { panic!("Odilia error {:?}", e); } }; - let root_ = ROOT_A11Y.clone(); - if matches!(item.object.id.clone(), root_) { + let _root = ROOT_A11Y; + if matches!(item.object.id.clone(), _root) { break; } } @@ -93,7 +93,7 @@ async fn reads_while_writing(cache: Cache, ids: Vec, items: let cache_1 = Arc::new(cache); let cache_2 = Arc::clone(&cache_1); let mut write_handle = tokio::spawn(async move { - cache_1.add_all(items); + let _ = cache_1.add_all(items); }); let mut read_handle = tokio::spawn(async move { let mut ids = VecDeque::from(ids); @@ -196,7 +196,7 @@ fn cache_benchmark(c: &mut Criterion) { item }) .collect(); - cache.add_all(all_items); + let _ = cache.add_all(all_items); let children = cache .by_id .iter() From a36619d9e0546ee61600d36321ff8c1f224c0306 Mon Sep 17 00:00:00 2001 From: Luuk van der Duim Date: Sun, 3 Mar 2024 23:38:11 +0100 Subject: [PATCH 8/8] Satisfy cache benchmarks need for 'atspi-connection' --- cache/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/cache/Cargo.toml b/cache/Cargo.toml index 7eb430e0..dceedd42 100644 --- a/cache/Cargo.toml +++ b/cache/Cargo.toml @@ -28,6 +28,7 @@ smartstring = { version = "1.0.1", features = ["serde"] } [dev-dependencies] criterion = { version = "0.4.0", features = ["async_tokio", "html_reports"] } +atspi-connection.workspace = true rand = "0.8.5" serde_json.workspace = true tokio = { workspace = true, features = ["rt-multi-thread"] }