Skip to content

Commit a70959e

Browse files
committed
Use AsRef<str> for public arguments
1 parent 92d61d2 commit a70959e

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

async/examples/sunsetc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ async fn run(args: Args) -> Result<i32> {
8383
app.pty();
8484
}
8585
if let Some(c) = cmd {
86-
app.exec(&c);
86+
app.exec(c);
8787
}
8888
if let Some(c) = args.subsystem {
89-
app.subsystem(&c);
89+
app.subsystem(c);
9090
}
9191
for i in &args.identityfile {
9292
app.add_authkey(

async/src/cmdline_client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ impl CmdlineClient {
7878
self
7979
}
8080

81-
pub fn exec(&mut self, cmd: &str) -> &mut Self {
82-
self.cmd = SessionCommand::Exec(cmd.into());
81+
pub fn exec(&mut self, cmd: impl AsRef<str>) -> &mut Self {
82+
self.cmd = SessionCommand::Exec(cmd.as_ref().into());
8383
self
8484
}
8585

86-
pub fn subsystem(&mut self, subsystem: &str) -> &mut Self {
87-
self.cmd = SessionCommand::Subsystem(subsystem.into());
86+
pub fn subsystem(&mut self, subsystem: impl AsRef<str>) -> &mut Self {
87+
self.cmd = SessionCommand::Subsystem(subsystem.as_ref().into());
8888
self
8989
}
9090

src/channel.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,12 +1001,12 @@ impl<'g, 'a> CliSessionOpener<'g, 'a> {
10011001
self.send(Req::Shell)
10021002
}
10031003

1004-
pub fn exec(&mut self, cmd: &str) -> Result<()> {
1005-
self.send(Req::Exec(cmd))
1004+
pub fn exec(&mut self, cmd: impl AsRef<str>) -> Result<()> {
1005+
self.send(Req::Exec(cmd.as_ref()))
10061006
}
10071007

1008-
pub fn subsystem(&mut self, cmd: &str) -> Result<()> {
1009-
self.send(Req::Subsystem(cmd))
1008+
pub fn subsystem(&mut self, cmd: impl AsRef<str>) -> Result<()> {
1009+
self.send(Req::Subsystem(cmd.as_ref()))
10101010
}
10111011

10121012
fn send(&mut self, req: Req) -> Result<()> {

0 commit comments

Comments
 (0)