Skip to content

Commit bbd0154

Browse files
authored
Update stable Rust to 1.92 and satisfy Clippy. (#2421)
Time to get CI passing again.
1 parent e8d0837 commit bbd0154

File tree

33 files changed

+80
-64
lines changed

33 files changed

+80
-64
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ env:
33
# version like 1.70. Note that we only specify MAJOR.MINOR and not PATCH so that bugfixes still
44
# come automatically. If the version specified here is no longer the latest stable version,
55
# then please feel free to submit a PR that adjusts it along with the potential clippy fixes.
6-
RUST_STABLE_VER: "1.82" # In quotes because otherwise 1.70 would be interpreted as 1.7
6+
RUST_STABLE_VER: "1.92" # In quotes because otherwise 1.70 would be interpreted as 1.7
77

88
name: CI
99

druid-derive/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use syn::parse_macro_input;
2323
///
2424
/// - `#[data(ignore)]` makes the generated `Data::same` function skip comparing this field.
2525
/// - `#[data(same_fn="foo")]` uses the function `foo` for comparing this field. `foo` should
26-
/// be the name of a function with signature `fn(&T, &T) -> bool`, where `T` is the type of
27-
/// the field.
26+
/// be the name of a function with signature `fn(&T, &T) -> bool`, where `T` is the type of
27+
/// the field.
2828
/// - `#[data(eq)]` is shorthand for `#[data(same_fn = "PartialEq::eq")]`
2929
///
3030
/// # Example
@@ -61,7 +61,7 @@ pub fn derive_data(input: TokenStream) -> TokenStream {
6161
///
6262
/// - `#[lens(ignore)]` skips creating a lens for one field.
6363
/// - `#[lens(name="foo")]` gives the lens the specified name (instead of the default, which is to
64-
/// create a lens with the same name as the field).
64+
/// create a lens with the same name as the field).
6565
///
6666
/// # Example
6767
///

druid-shell/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ tga = ["piet-common/tga"]
6060
hdr = ["piet-common/hdr"]
6161
serde = ["piet-common/serde"]
6262

63+
[lints]
64+
# The 'objc' package is broken and abandoned, needs this hack.
65+
# https://github.com/SSheldon/rust-objc/issues/125
66+
rust.unexpected_cfgs = { level = "warn", check-cfg = ['cfg(feature, values("cargo-clippy"))'] }
67+
6368
[dependencies]
6469
piet-common = { version = "=0.7.0-cairo18" }
6570

druid-shell/examples/edit_text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl InputHandler for AppInputHandler {
209209
doc.composition = None;
210210
self.window_handle.request_anim_frame();
211211
}
212-
fn slice(&self, range: Range<usize>) -> Cow<str> {
212+
fn slice(&self, range: Range<usize>) -> Cow<'_, str> {
213213
self.state.borrow().text[range].to_string().into()
214214
}
215215
fn is_char_boundary(&self, i: usize) -> bool {

druid-shell/src/application.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,8 @@ impl Application {
173173
backend::Application::get_locale()
174174
}
175175
}
176+
177+
/// Perform any initialization needed for the testing harness.
178+
pub fn init_harness() {
179+
backend::init_harness();
180+
}

druid-shell/src/backend/gtk/application.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,5 @@ impl crate::platform::linux::ApplicationExt for crate::Application {
8787
})
8888
}
8989
}
90+
91+
pub fn init_harness() {}

druid-shell/src/backend/mac/application.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use std::cell::RefCell;
99
use std::ffi::c_void;
1010
use std::rc::Rc;
11+
use std::sync::Once;
1112

1213
use cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicyRegular};
1314
use cocoa::base::{id, nil, NO, YES};
@@ -183,3 +184,10 @@ extern "C" fn handle_menu_item(this: &mut Object, _: Sel, item: id) {
183184
(*inner).command(tag as u32);
184185
}
185186
}
187+
188+
pub fn init_harness() {
189+
static INIT: Once = Once::new();
190+
INIT.call_once(|| unsafe {
191+
let _app: id = msg_send![class!(NSApplication), sharedApplication];
192+
});
193+
}

druid-shell/src/backend/wayland/application.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl Application {
372372
return;
373373
}
374374

375-
if appdata.handles.borrow().len() == 0 {
375+
if appdata.handles.borrow().is_empty() {
376376
tracing::debug!("shutting down, no window remaining");
377377
signal.stop();
378378
return;
@@ -566,3 +566,5 @@ impl Seat {
566566
}
567567
}
568568
}
569+
570+
pub fn init_harness() {}

druid-shell/src/backend/wayland/display.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ where
4949

5050
pub trait GlobalEventDispatch {
5151
fn subscribe(&self, sub: impl Into<GlobalEventSubscription>) -> GlobalEventSubscription;
52+
#[expect(dead_code)] // Until it's not dead
5253
fn release(&self, s: &GlobalEventSubscription);
5354
}
5455

druid-shell/src/backend/wayland/surfaces/popup.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,7 @@ impl Surface {
122122
tracing::debug!("{:?} {:?}", obj, event);
123123
});
124124

125-
let wl_xdg_popup = match parent.surface(&wl_xdg_surface, &wl_xdg_pos) {
126-
Ok(p) => p,
127-
Err(cause) => return Err(cause),
128-
};
125+
let wl_xdg_popup = parent.surface(&wl_xdg_surface, &wl_xdg_pos)?;
129126
wl_xdg_popup.quick_assign({
130127
let wl_surface = wl_surface.clone();
131128
move |_xdg_popup, event, _| {

0 commit comments

Comments
 (0)