diff options
Diffstat (limited to 'alacritty/src')
-rw-r--r-- | alacritty/src/display/hint.rs | 3 | ||||
-rw-r--r-- | alacritty/src/event.rs | 11 | ||||
-rw-r--r-- | alacritty/src/input.rs | 2 | ||||
-rw-r--r-- | alacritty/src/renderer/mod.rs | 7 | ||||
-rw-r--r-- | alacritty/src/renderer/rects.rs | 3 | ||||
-rw-r--r-- | alacritty/src/renderer/text/glyph_cache.rs | 7 |
6 files changed, 18 insertions, 15 deletions
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs index 7e2e4126..57087e45 100644 --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -2,6 +2,7 @@ use std::cmp::Reverse; use std::collections::HashSet; use std::iter; +use ahash::RandomState; use winit::keyboard::ModifiersState; use alacritty_terminal::grid::{BidirectionalIterator, Dimensions}; @@ -307,7 +308,7 @@ pub fn visible_unique_hyperlinks_iter<T>(term: &Term<T>) -> impl Iterator<Item = let mut display_iter = term.grid().display_iter().peekable(); // Avoid creating hints for the same hyperlinks, but from a different places. - let mut unique_hyperlinks = HashSet::new(); + let mut unique_hyperlinks = HashSet::<Hyperlink, RandomState>::default(); iter::from_fn(move || { // Find the start of the next unique hyperlink. diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 426b207e..0ffc46a0 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -14,6 +14,7 @@ use std::sync::atomic::Ordering; use std::time::{Duration, Instant}; use std::{env, f32, mem}; +use ahash::RandomState; use log::{debug, error, info, warn}; #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] use wayland_client::{Display as WaylandDisplay, EventQueue}; @@ -1044,7 +1045,7 @@ pub enum TouchPurpose { Scroll(TouchEvent), Zoom(TouchZoom), Tap(TouchEvent), - Invalid(HashSet<u64>), + Invalid(HashSet<u64, RandomState>), } impl Default for TouchPurpose { @@ -1085,8 +1086,8 @@ impl TouchZoom { } /// Get active touch slots. - pub fn slots(&self) -> HashSet<u64> { - let mut set = HashSet::new(); + pub fn slots(&self) -> HashSet<u64, RandomState> { + let mut set = HashSet::default(); set.insert(self.slots.0.id); set.insert(self.slots.1.id); set @@ -1401,7 +1402,7 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> { pub struct Processor { #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] wayland_event_queue: Option<EventQueue>, - windows: HashMap<WindowId, WindowContext>, + windows: HashMap<WindowId, WindowContext, RandomState>, cli_options: CliOptions, config: Rc<UiConfig>, } @@ -1423,7 +1424,7 @@ impl Processor { }); Processor { - windows: HashMap::new(), + windows: Default::default(), config: Rc::new(config), cli_options, #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index a8fb09b5..56832aff 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -780,7 +780,7 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { TouchPurpose::Tap(start) => TouchPurpose::Zoom(TouchZoom::new((start, touch))), TouchPurpose::Zoom(zoom) => TouchPurpose::Invalid(zoom.slots()), TouchPurpose::Scroll(event) | TouchPurpose::Select(event) => { - let mut set = HashSet::new(); + let mut set = HashSet::default(); set.insert(event.id); TouchPurpose::Invalid(set) }, diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs index fc586dc9..98e29542 100644 --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -3,6 +3,7 @@ use std::ffi::{CStr, CString}; use std::sync::atomic::{AtomicBool, Ordering}; use std::{fmt, ptr}; +use ahash::RandomState; use crossfont::Metrics; use glutin::context::{ContextApi, GlContext, PossiblyCurrentContext}; use glutin::display::{GetGlDisplay, GlDisplay}; @@ -290,13 +291,13 @@ impl GlExtensions { /// /// This function will lazyly load OpenGL extensions. fn contains(extension: &str) -> bool { - static OPENGL_EXTENSIONS: OnceCell<HashSet<&'static str>> = OnceCell::new(); + static OPENGL_EXTENSIONS: OnceCell<HashSet<&'static str, RandomState>> = OnceCell::new(); OPENGL_EXTENSIONS.get_or_init(Self::load_extensions).contains(extension) } /// Load available OpenGL extensions. - fn load_extensions() -> HashSet<&'static str> { + fn load_extensions() -> HashSet<&'static str, RandomState> { unsafe { let extensions = gl::GetString(gl::EXTENSIONS); @@ -313,7 +314,7 @@ impl GlExtensions { } else { match CStr::from_ptr(extensions as *mut _).to_str() { Ok(ext) => ext.split_whitespace().collect(), - Err(_) => HashSet::new(), + Err(_) => Default::default(), } } } diff --git a/alacritty/src/renderer/rects.rs b/alacritty/src/renderer/rects.rs index 8f6204c2..8d7a78e6 100644 --- a/alacritty/src/renderer/rects.rs +++ b/alacritty/src/renderer/rects.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use std::mem; +use ahash::RandomState; use crossfont::Metrics; use alacritty_terminal::grid::Dimensions; @@ -157,7 +158,7 @@ impl RenderLine { /// Lines for underline and strikeout. #[derive(Default)] pub struct RenderLines { - inner: HashMap<Flags, Vec<RenderLine>>, + inner: HashMap<Flags, Vec<RenderLine>, RandomState>, } impl RenderLines { diff --git a/alacritty/src/renderer/text/glyph_cache.rs b/alacritty/src/renderer/text/glyph_cache.rs index 72415900..a750e4e7 100644 --- a/alacritty/src/renderer/text/glyph_cache.rs +++ b/alacritty/src/renderer/text/glyph_cache.rs @@ -1,11 +1,10 @@ use std::collections::HashMap; -use std::hash::BuildHasherDefault; +use ahash::RandomState; use crossfont::{ Error as RasterizerError, FontDesc, FontKey, GlyphKey, Metrics, Rasterize, RasterizedGlyph, Rasterizer, Size, Slant, Style, Weight, }; -use fnv::FnvHasher; use log::{error, info}; use unicode_width::UnicodeWidthChar; @@ -46,7 +45,7 @@ pub struct Glyph { /// representations of the same code point. pub struct GlyphCache { /// Cache of buffered glyphs. - cache: HashMap<GlyphKey, Glyph, BuildHasherDefault<FnvHasher>>, + cache: HashMap<GlyphKey, Glyph, RandomState>, /// Rasterizer for loading new glyphs. rasterizer: Rasterizer, @@ -91,7 +90,7 @@ impl GlyphCache { let metrics = rasterizer.metrics(regular, font.size())?; Ok(Self { - cache: HashMap::default(), + cache: Default::default(), rasterizer, font_size: font.size(), font_key: regular, |