diff --git a/crates/edit/src/helpers.rs b/crates/edit/src/helpers.rs index 756292b8575..f8539f8155f 100644 --- a/crates/edit/src/helpers.rs +++ b/crates/edit/src/helpers.rs @@ -78,9 +78,6 @@ pub struct Size { } impl Size { - pub const MIN: Self = Self { width: 0, height: 0 }; - pub const MAX: Self = Self { width: CoordType::MAX, height: CoordType::MAX }; - pub fn as_rect(&self) -> Rect { Rect { left: 0, top: 0, right: self.width, bottom: self.height } } @@ -149,14 +146,6 @@ impl Rect { } } -/// [`std::cmp::minmax`] is unstable, as per usual. -pub fn minmax(v1: T, v2: T) -> [T; 2] -where - T: Ord, -{ - if v2 < v1 { [v2, v1] } else { [v1, v2] } -} - /// [`Read`] but with [`MaybeUninit`] buffers. pub fn file_read_uninit(file: &mut T, buf: &mut [MaybeUninit]) -> io::Result { unsafe { diff --git a/crates/edit/src/sys/unix.rs b/crates/edit/src/sys/unix.rs index ba9d06fde64..b0e275cfc55 100644 --- a/crates/edit/src/sys/unix.rs +++ b/crates/edit/src/sys/unix.rs @@ -6,7 +6,7 @@ //! Read the `windows` module for reference. //! TODO: This reminds me that the sys API should probably be a trait. -use std::ffi::{CStr, c_char, c_int, c_void}; +use std::ffi::{c_char, c_int, c_void}; use std::fs::File; use std::mem::{self, ManuallyDrop, MaybeUninit}; use std::os::fd::{AsRawFd as _, FromRawFd as _}; @@ -425,6 +425,7 @@ pub fn load_icu() -> io::Result { Ok(LibIcu { libicuuc, libicui18n }) } } + /// ICU, by default, adds the major version as a suffix to each exported symbol. /// They also recommend to disable this for system-level installations (`runConfigureICU Linux --disable-renaming`), /// but I found that many (most?) Linux distributions don't do this for some reason. @@ -459,7 +460,7 @@ pub fn icu_detect_renaming_suffix(arena: &Arena, handle: NonNull) -> Are } // The library path is in `info.dli_fname`. - let path = match CStr::from_ptr(info.dli_fname).to_str() { + let path = match std::ffi::CStr::from_ptr(info.dli_fname).to_str() { Ok(name) => name, Err(_) => return res, }; @@ -502,7 +503,7 @@ where } else { // SAFETY: In this particular case we know that the string // is valid UTF-8, because it comes from icu.rs. - let name = unsafe { CStr::from_ptr(name) }; + let name = unsafe { std::ffi::CStr::from_ptr(name) }; let name = unsafe { name.to_str().unwrap_unchecked() }; let mut res = ManuallyDrop::new(ArenaString::new_in(arena));