Skip to content

Commit

Permalink
chore: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Apr 26, 2024
1 parent 2f54f67 commit 2f1cc86
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions wayland-cursor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ pub struct CursorTheme {
fallback: Option<FallBack>,
}

struct FallBack(Box<dyn Fn(&str, u32) -> Option<Cow<'static, [u8]>>>);
type FallBackInner = Box<dyn Fn(&str, u32) -> Option<Cow<'static, [u8]>>>;

struct FallBack(FallBackInner);

impl FallBack {
fn new<F>(fallback: F) -> Self
Expand Down Expand Up @@ -195,9 +197,7 @@ impl CursorTheme {
None => {
let cursor = match self.load_cursor(name, self.size) {
None => {
let Some(ref fallback) = self.fallback else {
return None;
};
let fallback = self.fallback.as_ref()?;
let data = fallback.0(name, self.size)?;
let images = xparser::parse_xcursor(&data)?;
let conn = Connection::from_backend(self.backend.upgrade()?);
Expand All @@ -221,10 +221,10 @@ impl CursorTheme {
/// # use wayland_cursor::CursorTheme;
/// # use wayland_client::{Connection, backend::InvalidId, protocol::wl_shm};
/// # fn example(conn: &Connection, shm: wl_shm::WlShm, size: u32) -> Result<CursorTheme, InvalidId> {
/// let mut theme = CursorTheme::load_or(conn, shm, "default", size);
/// theme.set_callback(|name, size| {
/// include_bytes!("./icons/default")
/// });
/// # let mut theme = CursorTheme::load_or(conn, shm, "default", size);
/// # theme.set_callback(|name, size| {
/// # include_bytes!("./icons/default")
/// # });
/// # }
/// ```
pub fn set_callback<F>(&mut self, fallback: F)
Expand Down

0 comments on commit 2f1cc86

Please sign in to comment.