Repository: alacritty/alacritty
File: alacritty/src/display/mod.rs (Rust)

Code before:
            renderer.finish();
        }

        window.set_visible(true);

        #[allow(clippy::single_match)]
        #[cfg(not(windows))]
        match config.window.startup_mode {
            #[cfg(target_os = "macos")]
            StartupMode::SimpleFullscreen => window.set_simple_fullscreen(true),
            #[cfg(not(any(target_os = "macos", windows)))]
            StartupMode::Maximized if !is_wayland => window.set_maximized(true),
            _ => (),
        }

        let hint_state = HintState::new(config.hints.alphabet());

        let debug_damage = config.debug.highlight_damage;
        let (damage_rects, next_frame_damage_rects) = if is_wayland || debug_damage {
            let vec = Vec::with_capacity(size_info.screen_lines());
            (vec.clone(), vec)
        } else {
            (Vec::new(), Vec::new())
        };

        // Disable vsync.
        let _ = surface.set_swap_interval(&context, SwapInterval::DontWait);

        Ok(Self {
            window,
            context: ManuallyDrop::new(Replaceable::new(context)),
            surface: ManuallyDrop::new(surface),
            renderer: ManuallyDrop::new(renderer),
            glyph_cache,
            hint_state,
            meter: Meter::new(),
            size_info,
            ime: Ime::new(),
            highlighted_hint: None,
            vi_highlighted_hint: None,
            is_wayland,
            cursor_hidden: false,
            frame_timer_info: Default::default(),
            visual_bell: VisualBell::from(&config.bell),
            colors: List::from(&config.colors),
            pending_update: Default::default(),
            pending_renderer_update: Default::default(),
            debug_damage,
            damage_rects,
            next_frame_damage_rects,
            hint_mouse_point: None,

Review comment (bug):
I'm not sure how to handle failure of this. It could fail just because there's no extension. Maybe we should distinguish the failure from no extension and from the actual changing?

Code after:
        }

        window.set_visible(true);

        #[allow(clippy::single_match)]
        #[cfg(not(windows))]
        match config.window.startup_mode {
            #[cfg(target_os = "macos")]
            StartupMode::SimpleFullscreen => window.set_simple_fullscreen(true),
            #[cfg(not(any(target_os = "macos", windows)))]
            StartupMode::Maximized if !is_wayland => window.set_maximized(true),
            _ => (),
        }

        let hint_state = HintState::new(config.hints.alphabet());

        let debug_damage = config.debug.highlight_damage;
        let (damage_rects, next_frame_damage_rects) = if is_wayland || debug_damage {
            let vec = Vec::with_capacity(size_info.screen_lines());
            (vec.clone(), vec)
        } else {
            (Vec::new(), Vec::new())
        };

        // Disable vsync.
        if let Err(err) = surface.set_swap_interval(&context, SwapInterval::DontWait) {
            info!("Failed to disable vsync: {}", err);
        }

        Ok(Self {
            window,
            context: ManuallyDrop::new(Replaceable::new(context)),
            surface: ManuallyDrop::new(surface),
            renderer: ManuallyDrop::new(renderer),
            glyph_cache,
            hint_state,
            meter: Meter::new(),
            size_info,
            ime: Ime::new(),
            highlighted_hint: None,
            vi_highlighted_hint: None,
            is_wayland,
            cursor_hidden: false,
            frame_timer: FrameTimer::new(),
            visual_bell: VisualBell::from(&config.bell),
            colors: List::from(&config.colors),
            pending_update: Default::default(),
            pending_renderer_update: Default::default(),
            debug_damage,
            damage_rects,
            next_frame_damage_rects,