From 2729c72c763793f962d271a291ab8476dba92bad Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Sat, 9 Aug 2025 20:25:03 -0400 Subject: [PATCH 01/14] ci: rm `config.devices.len()` assertion --- src/core/config.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/config.rs b/src/core/config.rs index 1007606..edf53d3 100644 --- a/src/core/config.rs +++ b/src/core/config.rs @@ -109,7 +109,8 @@ mod tests { fn test_load_configuration_file() { create_default_config_file(); let config = Config::load_configuration_file(); - assert_eq!(config.devices.len(), 0); + // non-deterministic + //assert_eq!(config.devices.len(), 0); assert_eq!(config.general.theme, Theme::default().to_string()); assert!(!config.general.expert_mode); assert_eq!(config.general.backup_folder, CACHE_DIR.join("backups")); From 54308e1c584071362f3a7899f8782a5abbb20f88 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Sat, 9 Aug 2025 20:18:06 -0400 Subject: [PATCH 02/14] ci(adb-sync): un-deprecate `adb_shell_command`; add warn to docs --- src/core/sync.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/sync.rs b/src/core/sync.rs index 8b90e89..b598836 100644 --- a/src/core/sync.rs +++ b/src/core/sync.rs @@ -61,12 +61,16 @@ pub enum AdbError { Generic(String), } +/// # WARNING +/// Use `adb::ACommand::shell` with `async` blocks instead. +/// This `fn` is prone to abuse! +/// +/// # About /// Runs an **arbitrary command** on the device's default `sh` implementation. /// Typically MKSH, but could be Ash. /// [More info](https://chromium.googlesource.com/aosp/platform/system/core/+/refs/heads/upstream/shell_and_utilities). /// /// If `serial` is empty, it lets ADB choose the default device. -#[deprecated = "Use [`adb::ACommand::shell`] with `async` blocks instead"] pub async fn adb_shell_command>( device_serial: S, action: String, From d383da804df13da6caab600ca20bcc928fde1846 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Sat, 9 Aug 2025 20:21:56 -0400 Subject: [PATCH 03/14] ci: `cargo clippy --fix; cargo fmt` --- src/core/sync.rs | 2 +- src/gui/mod.rs | 2 +- src/gui/views/about.rs | 2 +- src/gui/views/list.rs | 10 +++++----- src/gui/views/settings.rs | 6 +++++- src/gui/widgets/package_row.rs | 6 +++++- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/core/sync.rs b/src/core/sync.rs index b598836..1235ef7 100644 --- a/src/core/sync.rs +++ b/src/core/sync.rs @@ -333,7 +333,7 @@ pub async fn get_devices_list() -> Vec { model: format!("{} {}", get_device_brand(serial), get_device_model(serial)), android_sdk: get_android_sdk(serial), user_list: list_users_idx_prot(serial), - adb_id: serial.to_string(), + adb_id: serial.clone(), }); } OperationResult::Ok(device_list) diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 72597a9..44f59b2 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -347,7 +347,7 @@ impl Application for UadGui { } } - fn view(&self) -> Element { + fn view(&self) -> Element<'_, Self::Message, Self::Theme, Renderer> { let navigation_container = nav_menu( &self.devices_list, self.selected_device.clone(), diff --git a/src/gui/views/about.rs b/src/gui/views/about.rs index 8413e69..f9b11a9 100644 --- a/src/gui/views/about.rs +++ b/src/gui/views/about.rs @@ -29,7 +29,7 @@ impl About { } // other events are handled by UadGui update() } - pub fn view(&self, update_state: &UpdateState) -> Element { + pub fn view(&self, update_state: &UpdateState) -> Element<'_, Message, Theme, Renderer> { let about_text = text(format!( "Universal Android Debloater Next Generation ({NAME}) is a free and open-source community project \naiming at simplifying the removal of pre-installed apps on any Android device." )); diff --git a/src/gui/views/list.rs b/src/gui/views/list.rs index d48002c..0add30d 100644 --- a/src/gui/views/list.rs +++ b/src/gui/views/list.rs @@ -376,7 +376,7 @@ impl List { self.copy_confirmation = true; Command::batch(vec![ iced::clipboard::write::(err), - Command::perform(Self::delay_hide_copy_confirmation(), |_| { + Command::perform(Self::delay_hide_copy_confirmation(), |()| { Message::HideCopyConfirmation }), ]) @@ -393,7 +393,7 @@ impl List { &self, settings: &Settings, selected_device: &Phone, - ) -> Element { + ) -> Element<'_, Message, Theme, Renderer> { match &self.loading_state { LoadingState::DownloadingList => waiting_view( &format!("Downloading latest {NAME} lists from GitHub. Please wait..."), @@ -438,7 +438,7 @@ impl List { } } - fn control_panel(&self, selected_device: &Phone) -> Element { + fn control_panel(&self, selected_device: &Phone) -> Element<'_, Message, Theme, Renderer> { let search_packages = text_input("Search packages...", &self.input_value) .width(Length::Fill) .on_input(Message::SearchInputChanged) @@ -504,7 +504,7 @@ impl List { &self, settings: &Settings, selected_device: &Phone, - ) -> Element { + ) -> Element<'_, Message, Theme, Renderer> { let packages = self .filtered_packages .iter() @@ -665,7 +665,7 @@ impl List { device: &Phone, settings: &Settings, packages: &[PackageRow], - ) -> Element { + ) -> Element<'_, Message, Theme, Renderer> { const PACK_NO_USER_MSG: &str = "`selected_packages` implies a user must be selected"; // 5 element slice is cheap diff --git a/src/gui/views/settings.rs b/src/gui/views/settings.rs index 5cd3418..22e1d3c 100644 --- a/src/gui/views/settings.rs +++ b/src/gui/views/settings.rs @@ -252,7 +252,11 @@ impl Settings { } #[allow(clippy::too_many_lines)] - pub fn view(&self, phone: &Phone, apps_view: &AppsView) -> Element { + pub fn view( + &self, + phone: &Phone, + apps_view: &AppsView, + ) -> Element<'_, Message, Theme, Renderer> { let radio_btn_theme = Theme::ALL .iter() .fold(row![].spacing(10), |column, option| { diff --git a/src/gui/widgets/package_row.rs b/src/gui/widgets/package_row.rs index 59c7e39..539531d 100644 --- a/src/gui/widgets/package_row.rs +++ b/src/gui/widgets/package_row.rs @@ -51,7 +51,11 @@ impl PackageRow { Command::none() } - pub fn view(&self, settings: &Settings, _phone: &Phone) -> Element { + pub fn view( + &self, + settings: &Settings, + _phone: &Phone, + ) -> Element<'_, Message, Theme, Renderer> { //let trash_svg = format!("{}/resources/assets/trash.svg", env!("CARGO_MANIFEST_DIR")); //let restore_svg = format!("{}/resources/assets/rotate.svg", env!("CARGO_MANIFEST_DIR")); let button_style; From 760b21da099081cafd39774dd2444ea72017caf0 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Sat, 9 Aug 2025 21:06:25 -0400 Subject: [PATCH 04/14] ci(clippy): rm some lints - `exit` isn't bad for apps, only for libs - `mem_forget` is rarely a mistake, and is trivial to catch - `string_to_string` is superseded by `implicit_clone` - `allow_attributes_without_reason` can be catched by reviewers --- Cargo.toml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e61bba0..9fc33bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,8 +23,8 @@ serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" fern = { version = "^0", features = ["colored"] } chrono = { version = "^0.4", default-features = false, features = [ - "std", - "clock", + "std", + "clock", ] } log = "^0.4" toml = "^0" @@ -63,11 +63,8 @@ deprecated_safe = "warn" [lints.clippy] undocumented_unsafe_blocks = "forbid" -exit = "deny" panic_in_result_fn = "warn" infinite_loop = "warn" -mem_forget = "warn" -string_to_string = "warn" format_push_string = "warn" large_include_file = "warn" shadow_unrelated = "warn" @@ -77,5 +74,4 @@ module_name_repetitions = "allow" # annoying disallowed_types = "deny" disallowed_methods = "deny" -allow_attributes_without_reason = "warn" pedantic = { level = "warn", priority = -1 } From 3fabd4a8d035ff58e37d5cc1f22f64582bec4b62 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Wed, 13 Aug 2025 16:01:24 -0400 Subject: [PATCH 05/14] refactor(gui/views/list): mark unused var lint regression at 26afc32b6989a3fa1c66ea6b7abe900146153979 --- src/gui/views/list.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/views/list.rs b/src/gui/views/list.rs index 0add30d..cd1def5 100644 --- a/src/gui/views/list.rs +++ b/src/gui/views/list.rs @@ -364,7 +364,7 @@ impl List { text_editor::Action::Edit(_) => { // Do nothing - ignore all editing operations } - text_editor::Action::Scroll { lines } => {} + text_editor::Action::Scroll { lines: _ } => {} // Allow all other actions (movement, selection, clicking, scrolling, etc.) _ => { self.description_content.perform(action); From 7477f02f83195c619980ed850264a0aa2135fbb6 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Wed, 13 Aug 2025 16:04:58 -0400 Subject: [PATCH 06/14] refactor: rm `PickList` (unused) --- src/gui/style.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/gui/style.rs b/src/gui/style.rs index 22f013c..05ed2fc 100644 --- a/src/gui/style.rs +++ b/src/gui/style.rs @@ -441,12 +441,6 @@ impl text_input::StyleSheet for Theme { } } -#[derive(Default, Debug, Clone, Copy)] -pub enum PickList { - #[default] - Default, -} - impl menu::StyleSheet for Theme { type Style = (); From 6a8ac88b679cdac07e966265d6e839147ae40f57 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Wed, 13 Aug 2025 18:17:42 -0400 Subject: [PATCH 07/14] ci: disable `test_save_changes` --- src/core/config.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/config.rs b/src/core/config.rs index edf53d3..f2329a4 100644 --- a/src/core/config.rs +++ b/src/core/config.rs @@ -116,6 +116,8 @@ mod tests { assert_eq!(config.general.backup_folder, CACHE_DIR.join("backups")); } + // non-deterministic + /* #[test] fn test_save_changes() { let mut settings = Settings::default(); @@ -125,6 +127,7 @@ mod tests { let config = Config::load_configuration_file(); assert_eq!(config.devices[0].device_id, device_id); } + */ #[test] fn test_default_config() { From 956d64aa6458b673d0faa65386c982f9933ec5dc Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Wed, 13 Aug 2025 18:44:02 -0400 Subject: [PATCH 08/14] refactor(gui/views/list): inline `delay_hide_copy_confirmation` fn added in 2ca3e05a8e7da5c3d62d90e6f64c44bedb3c5265 --- src/gui/views/list.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gui/views/list.rs b/src/gui/views/list.rs index cd1def5..a099de9 100644 --- a/src/gui/views/list.rs +++ b/src/gui/views/list.rs @@ -376,9 +376,11 @@ impl List { self.copy_confirmation = true; Command::batch(vec![ iced::clipboard::write::(err), - Command::perform(Self::delay_hide_copy_confirmation(), |()| { - Message::HideCopyConfirmation - }), + Command::perform( + // intentional delay + async { std::thread::sleep(std::time::Duration::from_secs(1)) }, + |()| Message::HideCopyConfirmation, + ), ]) } Message::HideCopyConfirmation => { @@ -926,10 +928,6 @@ impl List { } } } - - async fn delay_hide_copy_confirmation() { - std::thread::sleep(std::time::Duration::from_secs(1)); - } } fn error_view<'a>( From 0dc61c825f8f72833e191b42d273421292abf9e4 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Wed, 13 Aug 2025 19:03:42 -0400 Subject: [PATCH 09/14] refactor(adb): comment-out all `running` (user) stuff --- src/core/adb.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/adb.rs b/src/core/adb.rs index 2341ee4..5d85128 100644 --- a/src/core/adb.rs +++ b/src/core/adb.rs @@ -373,12 +373,12 @@ impl PmCommand { let ln = ln.trim_ascii_start(); let ln = ln.strip_prefix("UserInfo").unwrap_or(ln).trim_ascii_start(); let ln = ln.strip_prefix('{').unwrap_or(ln).trim_ascii(); - let run; + //let run; let ln = if let Some(l) = ln.strip_suffix("running") { - run = true; + //run = true; l.trim_ascii_end() } else { - run = false; + //run = false; ln }; let ln = ln.strip_suffix('}').unwrap_or(ln).trim_ascii_end(); @@ -407,7 +407,7 @@ impl PmCommand { id, //name: name.into(), //flags, - running: run, + //running: run, } }) .collect()) @@ -421,19 +421,21 @@ pub struct UserInfo { id: u16, //name: Box, //flags: u32, - running: bool, + //running: bool, } impl UserInfo { #[must_use] pub const fn get_id(&self) -> u16 { self.id } + /* /// Check if the user was logged-in /// at the time `pm list users` was invoked #[must_use] pub const fn was_running(&self) -> bool { self.running } + */ } #[cfg(test)] From fb131df2064e6303b60c630ad10ccecb1dd92fbc Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Wed, 13 Aug 2025 19:11:39 -0400 Subject: [PATCH 10/14] ci(adb): use `debug_assert` to not trigger `panic_in_result_fn` --- src/core/adb.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/adb.rs b/src/core/adb.rs index 5d85128..edc274a 100644 --- a/src/core/adb.rs +++ b/src/core/adb.rs @@ -348,8 +348,7 @@ impl PmCommand { .map(|p_ln| { debug_assert!(p_ln.starts_with(PACK_PREFIX)); let p = &p_ln[PACK_PREFIX.len()..]; - #[cfg(debug_assertions)] - assert!(PackageId::new(p.into()).is_some() || p == "android"); + debug_assert!(PackageId::new(p.into()).is_some() || p == "android"); String::from(p) }) .collect() From ab3081b11d4f6bc7897241394b7377dc08271281 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Wed, 13 Aug 2025 19:29:17 -0400 Subject: [PATCH 11/14] style(gui/views/list): `pkg`->`p` rename, to not shadow `pkg` --- src/gui/views/list.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/views/list.rs b/src/gui/views/list.rs index a099de9..c74b519 100644 --- a/src/gui/views/list.rs +++ b/src/gui/views/list.rs @@ -1025,7 +1025,7 @@ fn build_action_pkg_commands( && packages .get(u.index) .and_then(|user_pkgs| user_pkgs.get(selection.1)) - .is_some_and(|pkg| pkg.selected || settings.multi_user_mode) + .is_some_and(|p| p.selected || settings.multi_user_mode) }) { let u_pkg = &packages[u.index][selection.1]; let wanted_state = if settings.multi_user_mode { From d74a30b19451eddf36f8baaf51f473048b90ba32 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Fri, 31 Oct 2025 17:31:27 -0400 Subject: [PATCH 12/14] Revert "ci(cargo): replace `check` by `clippy`" This reverts commit 38554ca2d7f2fe8d4e278583bdd32850b2af48ae. --- .github/workflows/ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bce9c65..a1f9d3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,17 +22,23 @@ jobs: strategy: matrix: os: [ubuntu-22.04, windows-2022, macOS-14] - lint: [clippy, test, fmt] + lint: [check, test, clippy, fmt] exclude: # https://github.com/community/community/discussions/7835 + - os: windows-2022 + lint: clippy - os: windows-2022 lint: fmt + - os: macOS-14 + lint: clippy - os: macOS-14 lint: fmt include: - - lint: clippy - args: " --all-features -- -D clippy::all -W clippy::style" + - lint: check + args: " --all-features" - lint: test args: "" + - lint: clippy + args: " --all-features -- -D clippy::all -W clippy::style" - lint: fmt args: " -- --check" steps: From 15fcd106f733dd65b8bc406fae1749a6903192dd Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:00:28 -0400 Subject: [PATCH 13/14] ci(cargo-check): deny warns --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1f9d3a..1c4e1d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: include: - lint: check args: " --all-features" + env-flag: "-D warnings" - lint: test args: "" - lint: clippy @@ -56,7 +57,8 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: components: clippy,rustfmt - - run: cargo ${{ matrix.lint }}${{ matrix.args }} + - shell: bash + run: RUSTFLAGS='${{ matrix.env-flag }}' cargo ${{ matrix.lint }}${{ matrix.args }} coverage: name: coverage From f956c5d452269ad3c087f359ce88431df56e7568 Mon Sep 17 00:00:00 2001 From: Rudxain <76864299+Rudxain@users.noreply.github.com> Date: Fri, 31 Oct 2025 19:21:45 -0400 Subject: [PATCH 14/14] docs(main): rm redundant doc-comment this fixes `unused-doc-comments` lint warn --- src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index adb0800..1c197d8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,7 +39,6 @@ fn main() -> iced::Result { /// match `setup_logger().expect("Error` setting up logger") /// ''' fn setup_logger() -> Result<(), fern::InitError> { - /// Attach Windows terminal, only on Windows #[cfg(target_os = "windows")] { attach_windows_console();