Remove the AsAny helper trait

Trait upcasting (rust-lang/rust#65991) is stable since Rust 1.86, which
is already the MSRV, so dyn trait objects coerce to dyn Any directly.
Traits that needed AsAny now list Any as their supertrait, and the
as_any module is renamed to casting as only the impl_dyn_casting macro
remains.
This commit is contained in:
Olivier Goffart
2026-07-28 17:29:27 +00:00
parent c5eee2fb52
commit 874a1e31f1
8 changed files with 21 additions and 58 deletions

View File

@@ -1,4 +1,5 @@
use core::fmt;
use std::any::Any;
use std::error::Error;
use std::hash::Hash;
use std::ops::Deref;
@@ -8,8 +9,6 @@ use std::time::Duration;
#[doc(inline)]
pub use cursor_icon::CursorIcon;
use crate::as_any::AsAny;
/// The maximum width and height for a cursor when using [`CustomCursorSource::from_rgba`].
pub const MAX_CURSOR_SIZE: u16 = 2048;
@@ -79,7 +78,7 @@ impl From<CustomCursor> for Cursor {
#[derive(Clone, Debug)]
pub struct CustomCursor(pub Arc<dyn CustomCursorProvider>);
pub trait CustomCursorProvider: AsAny + fmt::Debug + Send + Sync {
pub trait CustomCursorProvider: Any + fmt::Debug + Send + Sync {
/// Whether a cursor was backed by animation.
fn is_animated(&self) -> bool;
}