Skip to content

Commit

Permalink
Fix borrowck error on older rustc versions
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Jan 6, 2025
1 parent 69eee8f commit e194d56
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/pam/rpassword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ fn read_unbuffered_with_feedback(
}
}


Ok(password)
}

Expand Down Expand Up @@ -209,16 +208,11 @@ impl Terminal<'_> {

/// Reads input with TTY echo disabled, but do provide visual feedback while typing.
pub fn read_password_with_feedback(&mut self) -> io::Result<PamBuffer> {
let (source, sink) = match self {
Terminal::StdIE(x, y) => (x as &mut dyn io::Read, y as &mut dyn io::Write),
Terminal::Tty(x) => (
&mut &*x as &mut dyn io::Read,
&mut &*x as &mut dyn io::Write,
),
};

if let Some(hide_input) = HiddenInput::new(true)? {
read_unbuffered_with_feedback(source, sink, &hide_input)
match self {
Terminal::StdIE(x, y) => read_unbuffered_with_feedback(x, y, &hide_input),
Terminal::Tty(x) => read_unbuffered_with_feedback(&mut &*x, &mut &*x, &hide_input),
}
} else {
read_unbuffered(self.source())
}
Expand Down

0 comments on commit e194d56

Please sign in to comment.