From a8252ad9dca2fc5d6c1614c4310390be07cf4f17 Mon Sep 17 00:00:00 2001 From: Samuel Date: Thu, 17 Oct 2024 14:36:22 -0300 Subject: [PATCH 1/3] Fix new lints for Rust/Clippy 1.82 --- crates/zng-app-context/src/lib.rs | 1 - crates/zng-app/src/running.rs | 2 ++ crates/zng-ext-font/src/lib.rs | 2 +- crates/zng-ext-window/src/control.rs | 21 ++++++++------------- crates/zng-state-map/src/lib.rs | 1 - crates/zng-task/src/crate_util.rs | 1 - crates/zng-var/src/animation/easing.rs | 1 - 7 files changed, 11 insertions(+), 18 deletions(-) diff --git a/crates/zng-app-context/src/lib.rs b/crates/zng-app-context/src/lib.rs index cfdd3442b..25dce8ad4 100644 --- a/crates/zng-app-context/src/lib.rs +++ b/crates/zng-app-context/src/lib.rs @@ -1688,7 +1688,6 @@ impl Drop for RunOnDrop { } } -#[expect(clippy::manual_unwrap_or)] // false positive, already fixed remove when Rust 1.82 is released fn panic_str<'s>(payload: &'s Box) -> &'s str { if let Some(s) = payload.downcast_ref::<&str>() { s diff --git a/crates/zng-app/src/running.rs b/crates/zng-app/src/running.rs index 5782647ef..baf15f2f6 100644 --- a/crates/zng-app/src/running.rs +++ b/crates/zng-app/src/running.rs @@ -1419,11 +1419,13 @@ impl AppEventSender { (Self(sender), receiver) } + #[allow(clippy::result_large_err)] // error does not move far up the stack fn send_app_event(&self, event: AppEvent) -> Result<(), AppDisconnected> { self.0.send(event)?; Ok(()) } + #[allow(clippy::result_large_err)] fn send_view_event(&self, event: zng_view_api::Event) -> Result<(), AppDisconnected> { self.0.send(AppEvent::ViewEvent(event))?; Ok(()) diff --git a/crates/zng-ext-font/src/lib.rs b/crates/zng-ext-font/src/lib.rs index ce8cb8637..8af193ddf 100644 --- a/crates/zng-ext-font/src/lib.rs +++ b/crates/zng-ext-font/src/lib.rs @@ -3151,7 +3151,7 @@ impl WhiteSpace { WhiteSpace::Preserve => Cow::Borrowed(text), WhiteSpace::Merge => { let is_white_space = |c: char| c.is_whitespace() && !"\n\r\u{85}".contains(c); - let t = text.trim_matches(&is_white_space); + let t = text.trim_matches(is_white_space); let mut prev_space = false; for c in t.chars() { diff --git a/crates/zng-ext-window/src/control.rs b/crates/zng-ext-window/src/control.rs index 649f57fa2..4e5ce994c 100644 --- a/crates/zng-ext-window/src/control.rs +++ b/crates/zng-ext-window/src/control.rs @@ -1172,13 +1172,10 @@ impl HeadedCtrl { extensions: WINDOWS.take_view_extensions_init(window_id), }; - match VIEW_PROCESS.open_window(request) { - Ok(()) => { - self.state = Some(state); - self.waiting_view = true; - } - Err(ViewProcessOffline) => {} //respawn - }; + if let Ok(()) = VIEW_PROCESS.open_window(request) { + self.state = Some(state); + self.waiting_view = true; + } // else respawn } /// Layout for already open window. @@ -1300,9 +1297,8 @@ impl HeadedCtrl { extensions: WINDOWS.take_view_extensions_init(window_id), }; - match VIEW_PROCESS.open_window(request) { - Ok(()) => self.waiting_view = true, - Err(ViewProcessOffline) => {} // respawn. + if let Ok(()) = VIEW_PROCESS.open_window(request) { + self.waiting_view = true } } @@ -1649,9 +1645,8 @@ impl HeadlessWithRendererCtrl { extensions: WINDOWS.take_view_extensions_init(window_id), }); - match r { - Ok(()) => self.waiting_view = true, - Err(ViewProcessOffline) => {} // respawn + if let Ok(()) = r { + self.waiting_view = true } } diff --git a/crates/zng-state-map/src/lib.rs b/crates/zng-state-map/src/lib.rs index 358eff80c..4def0b752 100644 --- a/crates/zng-state-map/src/lib.rs +++ b/crates/zng-state-map/src/lib.rs @@ -480,7 +480,6 @@ pub mod state_map { { /// Ensures a value is in the entry by inserting the default value if empty, /// and returns a mutable reference to the value in the entry. - #[expect(clippy::unwrap_or_default)] pub fn or_default(self) -> &'a mut T { self.or_insert_with(Default::default) } diff --git a/crates/zng-task/src/crate_util.rs b/crates/zng-task/src/crate_util.rs index 3a4a7ae3c..7f0914cc6 100644 --- a/crates/zng-task/src/crate_util.rs +++ b/crates/zng-task/src/crate_util.rs @@ -1,5 +1,4 @@ /// Converts a [`std::panic::catch_unwind`] payload to a str. -#[expect(clippy::manual_unwrap_or)] // false positive, already fixed for Rust 1.82 pub fn panic_str<'s>(payload: &'s Box) -> &'s str { if let Some(s) = payload.downcast_ref::<&str>() { s diff --git a/crates/zng-var/src/animation/easing.rs b/crates/zng-var/src/animation/easing.rs index 76ae7abac..5152c5fb3 100644 --- a/crates/zng-var/src/animation/easing.rs +++ b/crates/zng-var/src/animation/easing.rs @@ -180,7 +180,6 @@ impl fmt::Debug for EasingFn { } impl EasingFn { /// Create a closure that calls the easing function. - #[expect(clippy::redundant_closure)] // false positive pub fn ease_fn(&self) -> impl Fn(EasingTime) -> EasingStep + Send + Sync + 'static { let me = self.clone(); move |t| me(t) From 1aaaee2b47d9630aab2d7ebd0454c369478989a3 Mon Sep 17 00:00:00 2001 From: Samuel Date: Thu, 17 Oct 2024 15:08:11 -0300 Subject: [PATCH 2/3] Fix docs --- CHANGELOG.md | 1 + crates/zng-app/src/render.rs | 5 +++++ crates/zng/src/window.rs | 1 + 3 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3de509ca5..db850f8fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased +* Add `FrameBuilder::render_widgets` and `render_update_widgets` to `FrameBuilder` and `FrameUpdate` to inspect external render requests. * Implement support for raster and svg emojis. * Add `FontFace::ttf` to quickly access the full parsed TTF data. * Add `has_raster_images` and `has_svg_images` method to `FontFace` and `ShapedText`. diff --git a/crates/zng-app/src/render.rs b/crates/zng-app/src/render.rs index 0173e1ea6..a11138e8e 100644 --- a/crates/zng-app/src/render.rs +++ b/crates/zng-app/src/render.rs @@ -2736,6 +2736,11 @@ impl FrameUpdate { take_or_append(&mut self.extensions, &mut nested.extensions); } + /// External render update requests for this frame. + pub fn render_update_widgets(&self) -> &Arc { + &self.render_update_widgets + } + /// Finalize the update. /// /// Returns the property updates and the new clear color if any was set. diff --git a/crates/zng/src/window.rs b/crates/zng/src/window.rs index 356c985ab..4518186da 100644 --- a/crates/zng/src/window.rs +++ b/crates/zng/src/window.rs @@ -91,6 +91,7 @@ //! }; //! } //! } +//! # fn main() { } //! ``` //! //! # Full API From fc4dbb51ea7f41b1c8f389864eb3a16d1e9267a5 Mon Sep 17 00:00:00 2001 From: Samuel Date: Thu, 17 Oct 2024 16:08:03 -0300 Subject: [PATCH 3/3] Fix pip --- .github/workflows/release.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 341e86c2c..3b2a17567 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -137,6 +137,7 @@ jobs: needs: [check-ubuntu] env: ZNG_TP_LICENSES: true + PIP_BREAK_SYSTEM_PACKAGES: 1 steps: - name: install cargo-about if: ${{ github.event.inputs.skip_tests != 'true' || github.event.inputs.skip_release != 'true' }} @@ -149,9 +150,9 @@ jobs: - name: install dav1d python deps if: ${{ (github.event.inputs.skip_tests != 'true' || github.event.inputs.skip_release != 'true') && matrix.target == 'x86_64-unknown-linux-gnu' }} run: | - pip install -U pip --break-system-packages - pip install -U wheel setuptools --break-system-packages - pip install -U meson ninja --break-system-packages + pip install -U pip + pip install -U wheel setuptools + pip install -U meson ninja - name: build dav1d if: ${{ (github.event.inputs.skip_tests != 'true' || github.event.inputs.skip_release != 'true') && matrix.target == 'x86_64-unknown-linux-gnu' }} env: @@ -205,6 +206,7 @@ jobs: needs: [check-windows] env: ZNG_TP_LICENSES: true + PIP_BREAK_SYSTEM_PACKAGES: 1 steps: - name: install cargo-about if: ${{ github.event.inputs.skip_tests != 'true' || github.event.inputs.skip_release != 'true' }} @@ -220,9 +222,9 @@ jobs: - name: install dav1d python deps if: ${{ (github.event.inputs.skip_tests != 'true' || github.event.inputs.skip_release != 'true') && matrix.target == 'x86_64-pc-windows-msvc' }} run: | - pip install -U pip --break-system-packages - pip install -U wheel setuptools --break-system-packages - pip install -U meson ninja --break-system-packages + pip install -U pip + pip install -U wheel setuptools + pip install -U meson ninja - name: setup dav1d env if: ${{ (github.event.inputs.skip_tests != 'true' || github.event.inputs.skip_release != 'true') && matrix.target == 'x86_64-pc-windows-msvc' }} shell: bash @@ -284,6 +286,7 @@ jobs: needs: [check-macos] env: ZNG_TP_LICENSES: true + PIP_BREAK_SYSTEM_PACKAGES: 1 steps: - name: install cargo-about if: ${{ github.event.inputs.skip_tests != 'true' || github.event.inputs.skip_release != 'true' }} @@ -296,9 +299,9 @@ jobs: - name: install dav1d python deps if: ${{ github.event.inputs.skip_tests != 'true' || github.event.inputs.skip_release != 'true' }} run: | - pip install -U pip --break-system-packages - pip install -U wheel setuptools --break-system-packages - pip install -U meson ninja --break-system-packages + pip install -U pip + pip install -U wheel setuptools + pip install -U meson ninja - name: build dav1d if: ${{ github.event.inputs.skip_tests != 'true' || github.event.inputs.skip_release != 'true' }} env: