Remove the 'cast' dependency. (#208)

This commit is contained in:
Evgeniy Reizner 2020-08-23 15:22:49 +03:00 committed by GitHub
parent e504f1a3e2
commit 8efa8064c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -26,7 +26,6 @@ png = "0.16"
cc = "1.0"
[dependencies]
cast = "0.2"
raw-window-handle = "0.3.3"
[target.'cfg(windows)'.dependencies.winapi]

View file

@ -11,6 +11,7 @@ use crate::error::Error;
use crate::Result;
use crate::{CursorStyle, MenuHandle, UnixMenu};
use std::convert::TryFrom;
use std::ffi::CString;
use std::mem;
use std::os::raw;
@ -148,9 +149,9 @@ impl DisplayInfo {
let gc = (lib.XDefaultGC)(display, screen);
let screen_width = cast::usize((lib.XDisplayWidth)(display, screen))
let screen_width = usize::try_from((lib.XDisplayWidth)(display, screen))
.map_err(|e| Error::WindowCreate(format!("illegal width: {}", e)))?;
let screen_height = cast::usize((lib.XDisplayHeight)(display, screen))
let screen_height = usize::try_from((lib.XDisplayHeight)(display, screen))
.map_err(|e| Error::WindowCreate(format!("illegal height: {}", e)))?;
// andrewj: using this instead of XUniqueContext(), as the latter
@ -947,8 +948,8 @@ impl Window {
self.free_image();
self.ximage = Self::alloc_image(
&self.d,
cast::usize(self.width),
cast::usize(self.height),
self.width as usize,
self.height as usize,
&mut self.draw_buffer,
)
.expect("todo");