summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/tty
diff options
context:
space:
mode:
authorsterlingjensen <5555776+sterlingjensen@users.noreply.github.com>2019-12-05 11:14:47 -0600
committerChristian Duerr <contact@christianduerr.com>2019-12-05 18:14:47 +0100
commit72df0c06bf70b28378739d8097d3b2ad9b3a553d (patch)
treea9777c9ca02aae9c2cce6a926a90fef9345519bc /alacritty_terminal/src/tty
parent047719bcd23e0d50c0fd7d397ec53faaa051f88d (diff)
downloadalacritty-72df0c06bf70b28378739d8097d3b2ad9b3a553d.tar.gz
alacritty-72df0c06bf70b28378739d8097d3b2ad9b3a553d.zip
Remove unnecessary lifetimes from winpty
Diffstat (limited to 'alacritty_terminal/src/tty')
-rw-r--r--alacritty_terminal/src/tty/windows/conpty.rs10
-rw-r--r--alacritty_terminal/src/tty/windows/mod.rs20
-rw-r--r--alacritty_terminal/src/tty/windows/winpty.rs22
3 files changed, 24 insertions, 28 deletions
diff --git a/alacritty_terminal/src/tty/windows/conpty.rs b/alacritty_terminal/src/tty/windows/conpty.rs
index f34ad922..31f4c252 100644
--- a/alacritty_terminal/src/tty/windows/conpty.rs
+++ b/alacritty_terminal/src/tty/windows/conpty.rs
@@ -98,11 +98,7 @@ impl Drop for Conpty {
unsafe impl Send for Conpty {}
unsafe impl Sync for Conpty {}
-pub fn new<'a, C>(
- config: &Config<C>,
- size: &SizeInfo,
- _window_id: Option<usize>,
-) -> Option<Pty<'a>> {
+pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> Option<Pty> {
if !config.enable_experimental_conpty_backend {
return None;
}
@@ -132,7 +128,7 @@ pub fn new<'a, C>(
)
};
- assert!(result == S_OK);
+ assert_eq!(result, S_OK);
let mut success;
@@ -266,7 +262,7 @@ impl OnResize for ConptyHandle {
fn on_resize(&mut self, sizeinfo: &SizeInfo) {
if let Some(coord) = coord_from_sizeinfo(sizeinfo) {
let result = unsafe { (self.api.ResizePseudoConsole)(self.handle, coord) };
- assert!(result == S_OK);
+ assert_eq!(result, S_OK);
}
}
}
diff --git a/alacritty_terminal/src/tty/windows/mod.rs b/alacritty_terminal/src/tty/windows/mod.rs
index 436b5edf..c9c0be73 100644
--- a/alacritty_terminal/src/tty/windows/mod.rs
+++ b/alacritty_terminal/src/tty/windows/mod.rs
@@ -39,13 +39,13 @@ pub fn is_conpty() -> bool {
}
#[derive(Clone)]
-pub enum PtyHandle<'a> {
- Winpty(winpty::WinptyHandle<'a>),
+pub enum PtyHandle {
+ Winpty(winpty::WinptyHandle),
Conpty(conpty::ConptyHandle),
}
-pub struct Pty<'a> {
- handle: PtyHandle<'a>,
+pub struct Pty {
+ handle: PtyHandle,
// TODO: It's on the roadmap for the Conpty API to support Overlapped I/O.
// See https://github.com/Microsoft/console/issues/262
// When support for that lands then it should be possible to use
@@ -58,13 +58,13 @@ pub struct Pty<'a> {
child_watcher: ChildExitWatcher,
}
-impl<'a> Pty<'a> {
- pub fn resize_handle(&self) -> impl OnResize + 'a {
+impl Pty {
+ pub fn resize_handle(&self) -> impl OnResize {
self.handle.clone()
}
}
-pub fn new<'a, C>(config: &Config<C>, size: &SizeInfo, window_id: Option<usize>) -> Pty<'a> {
+pub fn new<C>(config: &Config<C>, size: &SizeInfo, window_id: Option<usize>) -> Pty {
if let Some(pty) = conpty::new(config, size, window_id) {
info!("Using Conpty agent");
IS_CONPTY.store(true, Ordering::Relaxed);
@@ -187,7 +187,7 @@ impl Write for EventedWritablePipe {
}
}
-impl<'a> OnResize for PtyHandle<'a> {
+impl OnResize for PtyHandle {
fn on_resize(&mut self, sizeinfo: &SizeInfo) {
match self {
PtyHandle::Winpty(w) => w.resize(sizeinfo),
@@ -199,7 +199,7 @@ impl<'a> OnResize for PtyHandle<'a> {
}
}
-impl<'a> EventedReadWrite for Pty<'a> {
+impl EventedReadWrite for Pty {
type Reader = EventedReadablePipe;
type Writer = EventedWritablePipe;
@@ -293,7 +293,7 @@ impl<'a> EventedReadWrite for Pty<'a> {
}
}
-impl<'a> EventedPty for Pty<'a> {
+impl EventedPty for Pty {
fn child_event_token(&self) -> mio::Token {
self.child_event_token
}
diff --git a/alacritty_terminal/src/tty/windows/winpty.rs b/alacritty_terminal/src/tty/windows/winpty.rs
index 258b7b2d..032c3399 100644
--- a/alacritty_terminal/src/tty/windows/winpty.rs
+++ b/alacritty_terminal/src/tty/windows/winpty.rs
@@ -34,24 +34,24 @@ use crate::tty::windows::Pty;
// We store a raw pointer because we need mutable access to call
// on_resize from a separate thread. Winpty internally uses a mutex
// so this is safe, despite outwards appearance.
-pub struct Agent<'a> {
- winpty: *mut Winpty<'a>,
+pub struct Agent {
+ winpty: *mut Winpty,
}
/// Handle can be cloned freely and moved between threads.
-pub type WinptyHandle<'a> = Arc<Agent<'a>>;
+pub type WinptyHandle = Arc<Agent>;
// Because Winpty has a mutex, we can do this.
-unsafe impl<'a> Send for Agent<'a> {}
-unsafe impl<'a> Sync for Agent<'a> {}
+unsafe impl Send for Agent {}
+unsafe impl Sync for Agent {}
-impl<'a> Agent<'a> {
- pub fn new(winpty: Winpty<'a>) -> Self {
+impl Agent {
+ pub fn new(winpty: Winpty) -> Self {
Self { winpty: Box::into_raw(Box::new(winpty)) }
}
/// Get immutable access to Winpty.
- pub fn winpty(&self) -> &Winpty<'a> {
+ pub fn winpty(&self) -> &Winpty {
unsafe { &*self.winpty }
}
@@ -63,7 +63,7 @@ impl<'a> Agent<'a> {
}
}
-impl<'a> Drop for Agent<'a> {
+impl Drop for Agent {
fn drop(&mut self) {
unsafe {
Box::from_raw(self.winpty);
@@ -75,7 +75,7 @@ impl<'a> Drop for Agent<'a> {
/// This is a placeholder value until we see how often long responses happen
const AGENT_TIMEOUT: u32 = 10000;
-pub fn new<'a, C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> Pty<'a> {
+pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> Pty {
// Create config
let mut wconfig = WinptyConfig::new(ConfigFlags::empty()).unwrap();
@@ -150,7 +150,7 @@ pub fn new<'a, C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>
}
}
-impl<'a> OnResize for Winpty<'a> {
+impl OnResize for Winpty {
fn on_resize(&mut self, sizeinfo: &SizeInfo) {
let (cols, lines) = (sizeinfo.cols().0, sizeinfo.lines().0);
if cols > 0 && cols <= u16::MAX as usize && lines > 0 && lines <= u16::MAX as usize {