Skip to content

Commit

Permalink
Fix new lints for Rust/Clippy 1.82 (#515)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamRodri authored Oct 17, 2024
1 parent 8a4791b commit a738c7c
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 27 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand All @@ -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:
Expand Down Expand Up @@ -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' }}
Expand All @@ -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
Expand Down Expand Up @@ -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' }}
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
1 change: 0 additions & 1 deletion crates/zng-app-context/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,6 @@ impl<F: FnOnce()> Drop for RunOnDrop<F> {
}
}

#[expect(clippy::manual_unwrap_or)] // false positive, already fixed remove when Rust 1.82 is released
fn panic_str<'s>(payload: &'s Box<dyn std::any::Any + Send + 'static>) -> &'s str {
if let Some(s) = payload.downcast_ref::<&str>() {
s
Expand Down
5 changes: 5 additions & 0 deletions crates/zng-app/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RenderUpdates> {
&self.render_update_widgets
}

/// Finalize the update.
///
/// Returns the property updates and the new clear color if any was set.
Expand Down
2 changes: 2 additions & 0 deletions crates/zng-app/src/running.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AppEvent>> {
self.0.send(event)?;
Ok(())
}

#[allow(clippy::result_large_err)]
fn send_view_event(&self, event: zng_view_api::Event) -> Result<(), AppDisconnected<AppEvent>> {
self.0.send(AppEvent::ViewEvent(event))?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/zng-ext-font/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
21 changes: 8 additions & 13 deletions crates/zng-ext-window/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/zng-state-map/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
1 change: 0 additions & 1 deletion crates/zng-task/src/crate_util.rs
Original file line number Diff line number Diff line change
@@ -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<dyn std::any::Any + Send + 'static>) -> &'s str {
if let Some(s) = payload.downcast_ref::<&str>() {
s
Expand Down
1 change: 0 additions & 1 deletion crates/zng-var/src/animation/easing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions crates/zng/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
//! };
//! }
//! }
//! # fn main() { }
//! ```
//!
//! # Full API
Expand Down

0 comments on commit a738c7c

Please sign in to comment.