Skip to content

Commit

Permalink
Cargo clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkj committed May 30, 2024
1 parent 8ee18a1 commit 893d574
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
1 change: 0 additions & 1 deletion async/src/cmdline_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ impl<'a> CmdlineRunner<'a> {
// perhaps a bad interaction with dup_async(),
// maybe the new guard needs to be on the dup-ed
// FDs?
()

// pty_guard = None;
// nix::sys::signal::raise(nix::sys::signal::Signal::SIGTSTP)
Expand Down
2 changes: 1 addition & 1 deletion async/src/knownhosts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where
}
}

const USER_KNOWN_HOSTS: &str = &".ssh/known_hosts";
const USER_KNOWN_HOSTS: &str = ".ssh/known_hosts";

fn user_known_hosts() -> Result<PathBuf, KnownHostsError> {
// home_dir() works fine on linux.
Expand Down
8 changes: 3 additions & 5 deletions embassy/src/embassy_sunset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl<'a> EmbassySunset<'a> {
// over the write fore Stderr. Something needs to mark it done,
// since the session can't proceed until it's consumed.
if let Some(h) = &inner.chan_handles[num.0 as usize] {
inner.runner.discard_channel_input(&h)?
inner.runner.discard_channel_input(h)?
}
}
}
Expand All @@ -267,10 +267,8 @@ impl<'a> EmbassySunset<'a> {
w.chan_write[idx].wake()
}

if !inner.runner.is_client() {
if inner.runner.ready_channel_send(ch, ChanData::Stderr)?.unwrap_or(0) > 0 {
w.chan_ext[idx].wake()
}
if !inner.runner.is_client() && inner.runner.ready_channel_send(ch, ChanData::Stderr)?.unwrap_or(0) > 0 {
w.chan_ext[idx].wake()
}

// TODO: do we want to keep waking it?
Expand Down
6 changes: 3 additions & 3 deletions src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,9 @@ pub enum SessionCommand<S: AsRef<str>> {
Subsystem(S),
}

impl<'a, S: AsRef<str> + 'a> Into<Req<'a>> for &'a SessionCommand<S> {
fn into(self) -> Req<'a> {
match self {
impl<'a, S: AsRef<str> + 'a> From<&'a SessionCommand<S>> for Req<'a> {
fn from(val: &'a SessionCommand<S>) -> Self {
match val {
SessionCommand::Shell => Req::Shell,
SessionCommand::Exec(s) => Req::Exec(s.as_ref()),
SessionCommand::Subsystem(s) => Req::Subsystem(s.as_ref()),
Expand Down
8 changes: 3 additions & 5 deletions src/kex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,9 @@ impl Kex {
let algos = Self::algo_negotiation(is_client, &remote_kexinit, algo_conf)?;
debug!("{algos}");

if first_kex && algos.strict_kex {
if s.recv_seq() != 1 {
debug!("kexinit has strict kex but wasn't first packet");
return error::PacketWrong.fail();
}
if first_kex && algos.strict_kex && s.recv_seq() != 1 {
debug!("kexinit has strict kex but wasn't first packet");
return error::PacketWrong.fail();
}
if is_client {
let p = algos.kex.make_kexdhinit()?;
Expand Down
2 changes: 1 addition & 1 deletion src/namelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct StringNames<'a>(pub &'a AsciiStr);
///
/// Deliberately `'static` since it should only come from hardcoded local strings
/// `SSH_NAME_*` in [`crate::sshnames`]. We don't validate string contents.
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct LocalNames(pub Vec<&'static str, MAX_LOCAL_NAMES>);

/// The general form that can store either representation
Expand Down

0 comments on commit 893d574

Please sign in to comment.