@@ -175,11 +175,7 @@ impl Session {
175
175
/// If `program` is not an absolute path, the `PATH` will be searched in an OS-defined way on
176
176
/// the host.
177
177
pub fn command < ' a , S : Into < Cow < ' a , str > > > ( & self , program : S ) -> Command < ' _ > {
178
- fn inner < ' s > ( this : & ' s Session , program : Cow < ' _ , str > ) -> Command < ' s > {
179
- this. raw_command ( & * shell_escape:: unix:: escape ( program) )
180
- }
181
-
182
- inner ( self , program. into ( ) )
178
+ self . raw_command ( & * shell_escape:: unix:: escape ( program. into ( ) ) )
183
179
}
184
180
185
181
/// Constructs a new [`Command`] for launching the program at path `program` on the remote
@@ -199,14 +195,10 @@ impl Session {
199
195
/// If `program` is not an absolute path, the `PATH` will be searched in an OS-defined way on
200
196
/// the host.
201
197
pub fn raw_command < S : AsRef < OsStr > > ( & self , program : S ) -> Command < ' _ > {
202
- fn inner < ' s > ( this : & ' s Session , program : & OsStr ) -> Command < ' s > {
203
- Command :: new (
204
- this,
205
- delegate ! ( & this. 0 , imp, { imp. raw_command( program) . into( ) } ) ,
206
- )
207
- }
208
-
209
- inner ( self , program. as_ref ( ) )
198
+ Command :: new (
199
+ self ,
200
+ delegate ! ( & self . 0 , imp, { imp. raw_command( program. as_ref( ) ) . into( ) } ) ,
201
+ )
210
202
}
211
203
212
204
/// Constructs a new [`Command`] for launching subsystem `program` on the remote
@@ -260,14 +252,10 @@ impl Session {
260
252
/// # Ok(()) }
261
253
/// ```
262
254
pub fn subsystem < S : AsRef < OsStr > > ( & self , program : S ) -> Command < ' _ > {
263
- fn inner < ' s > ( this : & ' s Session , program : & OsStr ) -> Command < ' s > {
264
- Command :: new (
265
- this,
266
- delegate ! ( & this. 0 , imp, { imp. subsystem( program) . into( ) } ) ,
267
- )
268
- }
269
-
270
- inner ( self , program. as_ref ( ) )
255
+ Command :: new (
256
+ self ,
257
+ delegate ! ( & self . 0 , imp, { imp. subsystem( program. as_ref( ) ) . into( ) } ) ,
258
+ )
271
259
}
272
260
273
261
/// Constructs a new [`Command`] that runs the provided shell command on the remote host.
@@ -310,13 +298,9 @@ impl Session {
310
298
/// [this article]: https://mywiki.wooledge.org/Arguments
311
299
/// [`shell-escape`]: https://crates.io/crates/shell-escape
312
300
pub fn shell < S : AsRef < str > > ( & self , command : S ) -> Command < ' _ > {
313
- fn inner < ' s > ( this : & ' s Session , command : & str ) -> Command < ' s > {
314
- let mut cmd = this. command ( "sh" ) ;
315
- cmd. arg ( "-c" ) . arg ( command) ;
316
- cmd
317
- }
318
-
319
- inner ( self , command. as_ref ( ) )
301
+ let mut cmd = self . command ( "sh" ) ;
302
+ cmd. arg ( "-c" ) . arg ( command. as_ref ( ) ) ;
303
+ cmd
320
304
}
321
305
322
306
/// Request to open a local/remote port forwarding.
0 commit comments