diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 273b8d4f8..bbec6d848 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ env: # version like 1.70. Note that we only specify MAJOR.MINOR and not PATCH so that bugfixes still # come automatically. If the version specified here is no longer the latest stable version, # then please feel free to submit a PR that adjusts it along with the potential clippy fixes. - RUST_STABLE_VER: "1.76" # In quotes because otherwise 1.70 would be interpreted as 1.7 + RUST_STABLE_VER: "1.82" # In quotes because otherwise 1.70 would be interpreted as 1.7 name: CI diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e51d5a07..7c9a1ebc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ You can find its changes [documented below](#083---2023-02-28). ### Changed +- Windows: Custom cursor is now encapsulated by `Rc` instead of `Arc`. ([#2409] by [@xStrom]) + ### Deprecated ### Removed @@ -1241,6 +1243,7 @@ Last release without a changelog :( [#2378]: https://github.com/linebender/druid/pull/2378 [#2380]: https://github.com/linebender/druid/pull/2380 [#2402]: https://github.com/linebender/druid/pull/2402 +[#2409]: https://github.com/linebender/druid/pull/2409 [Unreleased]: https://github.com/linebender/druid/compare/v0.8.3...master [0.8.3]: https://github.com/linebender/druid/compare/v0.8.2...v0.8.3 diff --git a/druid-derive/tests/ignore.rs b/druid-derive/tests/ignore.rs index ba08ffe03..1b4e1d67f 100644 --- a/druid-derive/tests/ignore.rs +++ b/druid-derive/tests/ignore.rs @@ -24,6 +24,7 @@ fn ignore_item_without_data_impl() { use std::path::PathBuf; #[derive(Clone, Data)] + #[allow(dead_code)] struct CoolStruct { len: usize, #[data(ignore)] @@ -35,7 +36,12 @@ fn ignore_item_without_data_impl() { #[test] fn tuple_struct() { #[derive(Clone, Data)] - struct Tup(usize, #[data(ignore)] usize); + struct Tup( + usize, + #[data(ignore)] + #[allow(dead_code)] + usize, + ); let one = Tup(1, 1); let two = Tup(1, 5); diff --git a/druid-derive/tests/with_same.rs b/druid-derive/tests/with_same.rs index 7255528d6..ca7e8c13f 100644 --- a/druid-derive/tests/with_same.rs +++ b/druid-derive/tests/with_same.rs @@ -14,22 +14,22 @@ fn same_fn() { let one = Nanana { bits: 1.0, - peq: std::f64::NAN, + peq: f64::NAN, }; let two = Nanana { bits: 1.0, - peq: std::f64::NAN, + peq: f64::NAN, }; //according to partialeq, two NaNs are never equal assert!(!one.same(&two)); let one = Nanana { - bits: std::f64::NAN, + bits: f64::NAN, peq: 1.0, }; let two = Nanana { - bits: std::f64::NAN, + bits: f64::NAN, peq: 1.0, }; @@ -51,17 +51,13 @@ fn enums() { Tri(#[data(same_fn = "same_sign")] f64), } - let oneone = Hi::One { - bits: std::f64::NAN, - }; - let onetwo = Hi::One { - bits: std::f64::NAN, - }; + let oneone = Hi::One { bits: f64::NAN }; + let onetwo = Hi::One { bits: f64::NAN }; assert!(oneone.same(&onetwo)); let twoone = Hi::Two { bits: -1.1 }; let twotwo = Hi::Two { - bits: std::f64::NEG_INFINITY, + bits: f64::NEG_INFINITY, }; assert!(twoone.same(&twotwo)); diff --git a/druid-shell/src/application.rs b/druid-shell/src/application.rs index 97483f6e3..c1f26529e 100644 --- a/druid-shell/src/application.rs +++ b/druid-shell/src/application.rs @@ -50,7 +50,7 @@ static APPLICATION_CREATED: AtomicBool = AtomicBool::new(false); thread_local! { /// A reference object to the current `Application`, if any. - static GLOBAL_APP: RefCell> = RefCell::new(None); + static GLOBAL_APP: RefCell> = const { RefCell::new(None) }; } impl Application { diff --git a/druid-shell/src/backend/mac/text_input.rs b/druid-shell/src/backend/mac/text_input.rs index 8b7583bcd..417425cb6 100644 --- a/druid-shell/src/backend/mac/text_input.rs +++ b/druid-shell/src/backend/mac/text_input.rs @@ -597,7 +597,7 @@ fn decode_nsrange( range: &NSRange, start_offset: usize, ) -> Option> { - if range.location as usize >= i32::max_value() as usize { + if range.location as usize >= i32::MAX as usize { return None; } let start_offset_utf16 = edit_lock.utf8_to_utf16(0..start_offset); diff --git a/druid-shell/src/backend/wayland/outputs/mod.rs b/druid-shell/src/backend/wayland/outputs/mod.rs index 239ede727..b1b80162a 100644 --- a/druid-shell/src/backend/wayland/outputs/mod.rs +++ b/druid-shell/src/backend/wayland/outputs/mod.rs @@ -94,6 +94,7 @@ pub(super) fn current() -> Result, error::Error> { Ok(result.take()) } +#[allow(dead_code)] pub trait Wayland { fn consume<'a>( &'a mut self, @@ -130,6 +131,7 @@ impl From<(i32, i32)> for Position { } #[derive(Debug, Default, Clone)] +#[allow(dead_code)] pub struct Mode { pub logical: Dimensions, pub refresh: i32, diff --git a/druid-shell/src/backend/web/window.rs b/druid-shell/src/backend/web/window.rs index 80f74fb77..ab6ad542f 100644 --- a/druid-shell/src/backend/web/window.rs +++ b/druid-shell/src/backend/web/window.rs @@ -619,7 +619,7 @@ impl WindowHandle { Ok(iv) => iv, Err(_) => { warn!("Timer duration exceeds 32 bit integer max"); - i32::max_value() + i32::MAX } }; diff --git a/druid-shell/src/backend/windows/util.rs b/druid-shell/src/backend/windows/util.rs index 752b0670c..c5f17947e 100644 --- a/druid-shell/src/backend/windows/util.rs +++ b/druid-shell/src/backend/windows/util.rs @@ -50,6 +50,7 @@ impl From for Error { } pub trait ToWide { + #[allow(dead_code)] fn to_wide_sized(&self) -> Vec; fn to_wide(&self) -> Vec; } @@ -147,6 +148,7 @@ type DCompositionCreateDevice = unsafe extern "system" fn( #[allow(non_snake_case)] // For member fields pub struct OptionalFunctions { + #[allow(dead_code)] pub GetDpiForSystem: Option, pub GetDpiForWindow: Option, pub SetProcessDpiAwarenessContext: Option, @@ -178,6 +180,7 @@ fn load_optional_functions() -> OptionalFunctions { $min_windows_version ); } else { + #[allow(clippy::missing_transmute_annotations)] let function = unsafe { mem::transmute::<_, $function>(function_ptr) }; $function = Some(function); } diff --git a/druid-shell/src/backend/windows/window.rs b/druid-shell/src/backend/windows/window.rs index 58deb0b4c..92835d678 100644 --- a/druid-shell/src/backend/windows/window.rs +++ b/druid-shell/src/backend/windows/window.rs @@ -141,7 +141,7 @@ pub enum PresentStrategy { /// 1. the system hands a mouse click event to `druid-shell` /// 2. `druid-shell` calls `WinHandler::mouse_up` /// 3. after some processing, the `WinHandler` calls `WindowHandle::save_as`, which schedules a -/// deferred op and returns immediately +/// deferred op and returns immediately /// 4. after some more processing, `WinHandler::mouse_up` returns /// 5. `druid-shell` displays the "save as" dialog that was requested in step 3. enum DeferredOp { @@ -301,9 +301,7 @@ struct DxgiState { } #[derive(Clone, PartialEq, Eq)] -// TODO: Convert this from Arc to Rc when doing a breaking release -#[allow(clippy::arc_with_non_send_sync)] -pub struct CustomCursor(Arc); +pub struct CustomCursor(Rc); #[derive(PartialEq, Eq)] struct HCursor(HCURSOR); @@ -2479,9 +2477,7 @@ impl WindowHandle { }; let icon = CreateIconIndirect(&mut icon_info); - // TODO: Convert this from Arc to Rc when doing a breaking release - #[allow(clippy::arc_with_non_send_sync)] - Some(Cursor::Custom(CustomCursor(Arc::new(HCursor(icon))))) + Some(Cursor::Custom(CustomCursor(Rc::new(HCursor(icon))))) } } else { None diff --git a/druid-shell/src/backend/x11/application.rs b/druid-shell/src/backend/x11/application.rs index a7bb3970e..0e66d9720 100644 --- a/druid-shell/src/backend/x11/application.rs +++ b/druid-shell/src/backend/x11/application.rs @@ -904,7 +904,7 @@ fn poll_with_timeout( break; } else { let millis = c_int::try_from(deadline.duration_since(now).as_millis()) - .unwrap_or(c_int::max_value() - 1); + .unwrap_or(c_int::MAX - 1); // The above .as_millis() rounds down. This means we would wake up before the // deadline is reached. Add one to 'simulate' rounding up instead. millis + 1 diff --git a/druid-shell/src/backend/x11/clipboard.rs b/druid-shell/src/backend/x11/clipboard.rs index 0c585aac7..50aba73b2 100644 --- a/druid-shell/src/backend/x11/clipboard.rs +++ b/druid-shell/src/backend/x11/clipboard.rs @@ -671,7 +671,7 @@ fn wait_for_event_with_deadline( // Use poll() to wait for the socket to become readable. let mut poll_fds = [PollFd::new(conn.as_raw_fd(), PollFlags::POLLIN)]; let poll_timeout = c_int::try_from(deadline.duration_since(now).as_millis()) - .unwrap_or(c_int::max_value() - 1) + .unwrap_or(c_int::MAX - 1) // The above rounds down, but we don't want to wake up to early, so add one .saturating_add(1); diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index b14e1410c..baa815ba4 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -13,7 +13,7 @@ //! variables. Here is a list of environment variables that `druid-shell` supports: //! //! - `DRUID_SHELL_DISABLE_X11_PRESENT`: if this is set and `druid-shell` is using the `x11` -//! backend, it will avoid using the Present extension. +//! backend, it will avoid using the Present extension. #![warn(rustdoc::broken_intra_doc_links)] #![allow(clippy::new_without_default)] diff --git a/druid-shell/src/text.rs b/druid-shell/src/text.rs index 305339754..a25042f55 100644 --- a/druid-shell/src/text.rs +++ b/druid-shell/src/text.rs @@ -390,11 +390,11 @@ pub trait InputHandler { /// This method also sets the composition range to `None`, and updates the /// selection: /// - /// - If both the selection's anchor and active are `< range.start`, then - /// nothing is updated. - If both the selection's anchor and active are `> - /// range.end`, then subtract `range.len()` from both, and add `text.len()`. - /// - If neither of the previous two conditions are true, then set both - /// anchor and active to `range.start + text.len()`. + /// - If both the selection's anchor and active are `< range.start`, then nothing is updated. + /// - If both the selection's anchor and active are `> range.end`, then subtract `range.len()` + /// from both, and add `text.len()`. + /// - If neither of the previous two conditions are true, then set both anchor and active to + /// `range.start + text.len()`. /// /// After the above update, if we increase each end of the selection if /// necessary to put it on a grapheme cluster boundary. diff --git a/druid-shell/src/window.rs b/druid-shell/src/window.rs index d2957cc04..1552b892f 100644 --- a/druid-shell/src/window.rs +++ b/druid-shell/src/window.rs @@ -439,7 +439,7 @@ impl WindowHandle { /// Get the DPI scale of the window. /// - /// The returned [`Scale`](crate::Scale) is a copy and thus its information will be stale after + /// The returned [`Scale`] is a copy and thus its information will be stale after /// the platform DPI changes. This means you should not stash it and rely on it later; it is /// only guaranteed to be valid for the current pass of the runloop. // TODO: Can we get rid of the Result/Error for ergonomics? @@ -461,7 +461,7 @@ pub struct WindowBuilder(backend::WindowBuilder); impl WindowBuilder { /// Create a new `WindowBuilder`. /// - /// Takes the [`Application`](crate::Application) that this window is for. + /// Takes the [`Application`] that this window is for. pub fn new(app: Application) -> WindowBuilder { WindowBuilder(backend::WindowBuilder::new(app.backend_app)) } diff --git a/druid/src/contexts.rs b/druid/src/contexts.rs index 5f1605315..f611da176 100644 --- a/druid/src/contexts.rs +++ b/druid/src/contexts.rs @@ -177,6 +177,7 @@ pub trait ChangeCtx { /// Convenience trait for invalidation and request methods available on multiple contexts. /// /// These methods are available on [`EventCtx`], [`LifeCycleCtx`], and [`UpdateCtx`]. +#[allow(dead_code)] pub trait RequestCtx: ChangeCtx { /// Request a [`paint`] pass. See ['request_paint'] /// diff --git a/druid/src/data.rs b/druid/src/data.rs index e8ce36d39..fff075f1a 100644 --- a/druid/src/data.rs +++ b/druid/src/data.rs @@ -307,7 +307,7 @@ impl Data for std::mem::Discriminant { } } -impl Data for std::mem::ManuallyDrop { +impl Data for std::mem::ManuallyDrop { fn same(&self, other: &Self) -> bool { (**self).same(&**other) } diff --git a/druid/src/event.rs b/druid/src/event.rs index ba081ee43..f89b11e68 100644 --- a/druid/src/event.rs +++ b/druid/src/event.rs @@ -152,14 +152,14 @@ pub enum Event { /// may be generated from a number of sources: /// /// - If your application uses menus (either window or context menus) - /// then the [`MenuItem`]s in the menu will each correspond to a `Command`. - /// When the menu item is selected, that [`Command`] will be delivered to - /// the root widget of the appropriate window. + /// then the [`MenuItem`]s in the menu will each correspond to a `Command`. + /// When the menu item is selected, that [`Command`] will be delivered to + /// the root widget of the appropriate window. /// - If you are doing work in another thread (using an [`ExtEventSink`]) - /// then [`Command`]s are the mechanism by which you communicate back to - /// the main thread. + /// then [`Command`]s are the mechanism by which you communicate back to + /// the main thread. /// - Widgets and other Druid components can send custom [`Command`]s at - /// runtime, via methods such as [`EventCtx::submit_command`]. + /// runtime, via methods such as [`EventCtx::submit_command`]. /// /// [`Widget`]: Widget /// [`EventCtx::submit_command`]: crate::EventCtx::submit_command diff --git a/druid/src/sub_window.rs b/druid/src/sub_window.rs index e126c1aed..e5f90ae4a 100644 --- a/druid/src/sub_window.rs +++ b/druid/src/sub_window.rs @@ -32,7 +32,7 @@ impl SubWindowDesc { /// Creates a subwindow requirement that hosts the provided widget within a sub window host. /// It will synchronise data updates with the provided parent_id if "sync" is true, and it will expect to be sent /// SUB_WINDOW_PARENT_TO_HOST commands to update the provided data for the widget. - pub fn new>( + pub fn new( parent_id: WidgetId, window_config: WindowConfig, widget: W, @@ -40,7 +40,7 @@ impl SubWindowDesc { env: Env, ) -> SubWindowDesc where - W: 'static, + W: Widget + 'static, U: Data, { let host_id = WidgetId::next(); diff --git a/druid/src/tests/harness.rs b/druid/src/tests/harness.rs index ce38bb021..de3b9b306 100644 --- a/druid/src/tests/harness.rs +++ b/druid/src/tests/harness.rs @@ -112,14 +112,14 @@ impl Harness<'_, T> { /// # Arguments /// /// * `data` - A structure that matches the type of the widget and that will be - /// passed to the `harness_closure` callback via the `Harness` structure. + /// passed to the `harness_closure` callback via the `Harness` structure. /// /// * `root` - The widget under test /// /// * `shape` - The shape of the render_context in the `Harness` structure /// /// * `harness_closure` - A closure used to interact with the widget under test through the - /// `Harness` structure. + /// `Harness` structure. /// /// * `render_context_closure` - A closure used to inspect the final render_context via the `TargetGuard` structure. /// diff --git a/druid/src/util.rs b/druid/src/util.rs index c8873686a..c7845ce92 100644 --- a/druid/src/util.rs +++ b/druid/src/util.rs @@ -39,6 +39,7 @@ pub trait ExtendDrain { /// This function may swap the underlying memory locations, /// so keep that in mind if one of the collections has a large allocation /// and it should keep that allocation. + #[allow(dead_code)] fn extend_drain(&mut self, source: &mut Self); } diff --git a/druid/src/widget/flex.rs b/druid/src/widget/flex.rs index cd7e3eb9a..a31e97e01 100644 --- a/druid/src/widget/flex.rs +++ b/druid/src/widget/flex.rs @@ -76,16 +76,16 @@ use tracing::{instrument, trace}; /// To experiment with these options, see the `flex` example in `druid/examples`. /// /// - [`CrossAxisAlignment`] determines how children are positioned on the -/// cross or 'minor' axis. The default is `CrossAxisAlignment::Center`. +/// cross or 'minor' axis. The default is `CrossAxisAlignment::Center`. /// /// - [`MainAxisAlignment`] determines how children are positioned on the main -/// axis; this is only meaningful if the container has more space on the main -/// axis than is taken up by its children. +/// axis; this is only meaningful if the container has more space on the main +/// axis than is taken up by its children. /// /// - [`must_fill_main_axis`] determines whether the container is obliged to -/// be maximally large on the major axis, as determined by its own constraints. -/// If this is `true`, then the container must fill the available space on that -/// axis; otherwise it may be smaller if its children are smaller. +/// be maximally large on the major axis, as determined by its own constraints. +/// If this is `true`, then the container must fill the available space on that +/// axis; otherwise it may be smaller if its children are smaller. /// /// Additional options can be set (or overridden) in the [`FlexParams`]. /// @@ -676,9 +676,7 @@ impl Widget for Flex { any_use_baseline |= alignment == CrossAxisAlignment::Baseline; let old_size = widget.layout_rect().size(); - let child_bc = - self.direction - .constraints(&loosened_bc, 0.0, std::f64::INFINITY); + let child_bc = self.direction.constraints(&loosened_bc, 0.0, f64::INFINITY); let child_size = widget.layout(ctx, &child_bc, data, env); if child_size.width.is_infinite() { diff --git a/druid/src/widget/sized_box.rs b/druid/src/widget/sized_box.rs index 84e2c1f13..4cfdf5f7b 100644 --- a/druid/src/widget/sized_box.rs +++ b/druid/src/widget/sized_box.rs @@ -4,7 +4,6 @@ //! A widget with predefined size. use crate::debug_state::DebugState; -use std::f64::INFINITY; use tracing::{instrument, trace, warn}; use crate::widget::prelude::*; @@ -71,8 +70,8 @@ impl SizedBox { /// [`expand_height`]: #method.expand_height /// [`expand_width`]: #method.expand_width pub fn expand(mut self) -> Self { - self.width = Some(KeyOrValue::Concrete(INFINITY)); - self.height = Some(KeyOrValue::Concrete(INFINITY)); + self.width = Some(KeyOrValue::Concrete(f64::INFINITY)); + self.height = Some(KeyOrValue::Concrete(f64::INFINITY)); self } @@ -80,7 +79,7 @@ impl SizedBox { /// /// This will force the child to have maximum width. pub fn expand_width(mut self) -> Self { - self.width = Some(KeyOrValue::Concrete(INFINITY)); + self.width = Some(KeyOrValue::Concrete(f64::INFINITY)); self } @@ -88,7 +87,7 @@ impl SizedBox { /// /// This will force the child to have maximum height. pub fn expand_height(mut self) -> Self { - self.height = Some(KeyOrValue::Concrete(INFINITY)); + self.height = Some(KeyOrValue::Concrete(f64::INFINITY)); self } diff --git a/druid/src/widget/split.rs b/druid/src/widget/split.rs index 9db08d557..f417660aa 100644 --- a/druid/src/widget/split.rs +++ b/druid/src/widget/split.rs @@ -420,7 +420,7 @@ impl Widget for Split { self.split_point_effective = { let (min_limit, max_limit) = self.split_side_limits(reduced_size); let reduced_axis_size = self.split_axis.major(reduced_size); - if reduced_axis_size.is_infinite() || reduced_axis_size <= std::f64::EPSILON { + if reduced_axis_size.is_infinite() || reduced_axis_size <= f64::EPSILON { 0.5 } else { self.split_point_chosen diff --git a/druid/src/widget/stepper.rs b/druid/src/widget/stepper.rs index 0fbded618..0fd8feb16 100644 --- a/druid/src/widget/stepper.rs +++ b/druid/src/widget/stepper.rs @@ -3,7 +3,6 @@ //! A stepper widget. -use std::f64::EPSILON; use std::time::Duration; use tracing::{instrument, trace}; @@ -34,8 +33,8 @@ impl Stepper { /// Create a new `Stepper`. pub fn new() -> Self { Stepper { - max: std::f64::MAX, - min: std::f64::MIN, + max: f64::MAX, + min: f64::MIN, step: 1.0, wrap: false, increase_active: false, @@ -66,7 +65,8 @@ impl Stepper { /// When wraparound is enabled incrementing above max behaves like this: /// - if the previous value is < max it becomes max /// - if the previous value is = max it becomes min - /// Same logic applies for decrementing + /// + /// Same logic applies for decrementing. /// /// The default is `false`. pub fn with_wraparound(mut self, wrap: bool) -> Self { @@ -76,8 +76,8 @@ impl Stepper { fn increment(&mut self, data: &mut f64) { let next = *data + self.step; - let was_greater = *data + EPSILON >= self.max; - let is_greater = next + EPSILON > self.max; + let was_greater = *data + f64::EPSILON >= self.max; + let is_greater = next + f64::EPSILON > self.max; *data = match (self.wrap, was_greater, is_greater) { (true, true, true) => self.min, (true, false, true) => self.max, @@ -88,8 +88,8 @@ impl Stepper { fn decrement(&mut self, data: &mut f64) { let next = *data - self.step; - let was_less = *data - EPSILON <= self.min; - let is_less = next - EPSILON < self.min; + let was_less = *data - f64::EPSILON <= self.min; + let is_less = next - f64::EPSILON < self.min; *data = match (self.wrap, was_less, is_less) { (true, true, true) => self.max, (true, false, true) => self.min, @@ -268,7 +268,7 @@ impl Widget for Stepper { skip(self, ctx, old_data, data, _env) )] fn update(&mut self, ctx: &mut UpdateCtx, old_data: &f64, data: &f64, _env: &Env) { - if (*data - old_data).abs() > EPSILON { + if (*data - old_data).abs() > f64::EPSILON { ctx.request_paint(); } } diff --git a/druid/src/widget/tabs.rs b/druid/src/widget/tabs.rs index f93c323eb..a9bfec0db 100644 --- a/druid/src/widget/tabs.rs +++ b/druid/src/widget/tabs.rs @@ -498,7 +498,7 @@ impl TabsTransitionState { } } -fn ensure_for_tabs( +fn ensure_for_tabs( contents: &mut Vec<(TP::Key, Content)>, policy: &TP, data: &TP::Input, diff --git a/druid/src/widget/value_textbox.rs b/druid/src/widget/value_textbox.rs index cd4680e69..7ab1a422a 100644 --- a/druid/src/widget/value_textbox.rs +++ b/druid/src/widget/value_textbox.rs @@ -21,16 +21,16 @@ const COMPLETE_EDITING: Selector = Selector::new("druid.builtin.textbox-complete /// in relation to the provided [`Formatter`]: /// /// - [`ValueTextBox::validate_while_editing`] takes a flag that determines whether -/// or not the textbox can display text that is not valid, while editing is -/// in progress. (Text will still be validated when the user attempts to complete -/// editing.) +/// or not the textbox can display text that is not valid, while editing is +/// in progress. (Text will still be validated when the user attempts to complete +/// editing.) /// /// - [`ValueTextBox::update_data_while_editing`] takes a flag that determines -/// whether the output value is updated during editing, when possible. +/// whether the output value is updated during editing, when possible. /// /// - [`ValueTextBox::delegate`] allows you to provide some implementation of -/// the [`ValidationDelegate`] trait, which receives a callback during editing; -/// this can be used to report errors further back up the tree. +/// the [`ValidationDelegate`] trait, which receives a callback during editing; +/// this can be used to report errors further back up the tree. pub struct ValueTextBox { child: TextBox, formatter: Box>, diff --git a/druid/src/widget/widget.rs b/druid/src/widget/widget.rs index 9abefab36..289218318 100644 --- a/druid/src/widget/widget.rs +++ b/druid/src/widget/widget.rs @@ -256,7 +256,7 @@ impl WidgetId { /// `u64::max_value() - raw`. #[allow(unsafe_code)] pub const fn reserved(raw: u16) -> WidgetId { - let id = u64::max_value() - raw as u64; + let id = u64::MAX - raw as u64; // safety: by construction this can never be zero. WidgetId(unsafe { std::num::NonZeroU64::new_unchecked(id) }) }