@@ -49,7 +49,7 @@ pub fn connect(opts: &SshOpts) -> RemoteResult<Session> {
4949 ssh_config. connection_timeout. as_secs( )
5050 ) ;
5151 if let Ok ( tcp_stream) = tcp_connect ( socket_addr, ssh_config. connection_timeout ) {
52- debug ! ( "Connection established with address {}" , socket_addr ) ;
52+ debug ! ( "Connection established with address {socket_addr}" ) ;
5353 stream = Some ( tcp_stream) ;
5454 break ;
5555 }
@@ -74,7 +74,7 @@ pub fn connect(opts: &SshOpts) -> RemoteResult<Session> {
7474 let mut session = match Session :: new ( ) {
7575 Ok ( s) => s,
7676 Err ( err) => {
77- error ! ( "Could not create session: {}" , err ) ;
77+ error ! ( "Could not create session: {err}" ) ;
7878 return Err ( RemoteError :: new_ex ( RemoteErrorType :: ConnectionError , err) ) ;
7979 }
8080 } ;
@@ -84,7 +84,7 @@ pub fn connect(opts: &SshOpts) -> RemoteResult<Session> {
8484 set_algo_prefs ( & mut session, opts, & ssh_config) ?;
8585 // Open connection and initialize handshake
8686 if let Err ( err) = session. handshake ( ) {
87- error ! ( "SSH handshake failed: {}" , err ) ;
87+ error ! ( "SSH handshake failed: {err}" ) ;
8888 return Err ( RemoteError :: new_ex ( RemoteErrorType :: ProtocolError , err) ) ;
8989 }
9090
@@ -96,7 +96,7 @@ pub fn connect(opts: &SshOpts) -> RemoteResult<Session> {
9696 return Ok ( session) ;
9797 }
9898 Err ( err) => {
99- error ! ( "Could not authenticate with ssh agent: {}" , err ) ;
99+ error ! ( "Could not authenticate with ssh agent: {err}" ) ;
100100 }
101101 }
102102 }
@@ -162,47 +162,47 @@ fn set_algo_prefs(session: &mut Session, opts: &SshOpts, config: &Config) -> Rem
162162 let params = & config. params ;
163163 trace ! ( "Configuring algorithm preferences..." ) ;
164164 if let Some ( compress) = params. compression {
165- trace ! ( "compression: {}" , compress ) ;
165+ trace ! ( "compression: {compress}" ) ;
166166 session. set_compress ( compress) ;
167167 }
168168
169169 // kex
170170 let algos = params. kex_algorithms . algorithms ( ) . join ( "," ) ;
171- trace ! ( "Configuring KEX algorithms: {}" , algos ) ;
171+ trace ! ( "Configuring KEX algorithms: {algos}" ) ;
172172 if let Err ( err) = session. method_pref ( SshMethodType :: Kex , algos. as_str ( ) ) {
173- error ! ( "Could not set KEX algorithms: {}" , err ) ;
173+ error ! ( "Could not set KEX algorithms: {err}" ) ;
174174 return Err ( RemoteError :: new_ex ( RemoteErrorType :: ProtocolError , err) ) ;
175175 }
176176
177177 // HostKey
178178 let algos = params. host_key_algorithms . algorithms ( ) . join ( "," ) ;
179- trace ! ( "Configuring HostKey algorithms: {}" , algos ) ;
179+ trace ! ( "Configuring HostKey algorithms: {algos}" ) ;
180180 if let Err ( err) = session. method_pref ( SshMethodType :: HostKey , algos. as_str ( ) ) {
181- error ! ( "Could not set host key algorithms: {}" , err ) ;
181+ error ! ( "Could not set host key algorithms: {err}" ) ;
182182 return Err ( RemoteError :: new_ex ( RemoteErrorType :: ProtocolError , err) ) ;
183183 }
184184
185185 // ciphers
186186 let algos = params. ciphers . algorithms ( ) . join ( "," ) ;
187- trace ! ( "Configuring Crypt algorithms: {}" , algos ) ;
187+ trace ! ( "Configuring Crypt algorithms: {algos}" ) ;
188188 if let Err ( err) = session. method_pref ( SshMethodType :: CryptCs , algos. as_str ( ) ) {
189- error ! ( "Could not set crypt algorithms (client-server): {}" , err ) ;
189+ error ! ( "Could not set crypt algorithms (client-server): {err}" ) ;
190190 return Err ( RemoteError :: new_ex ( RemoteErrorType :: ProtocolError , err) ) ;
191191 }
192192 if let Err ( err) = session. method_pref ( SshMethodType :: CryptSc , algos. as_str ( ) ) {
193- error ! ( "Could not set crypt algorithms (server-client): {}" , err ) ;
193+ error ! ( "Could not set crypt algorithms (server-client): {err}" ) ;
194194 return Err ( RemoteError :: new_ex ( RemoteErrorType :: ProtocolError , err) ) ;
195195 }
196196
197197 // MAC
198198 let algos = params. mac . algorithms ( ) . join ( "," ) ;
199- trace ! ( "Configuring MAC algorithms: {}" , algos ) ;
199+ trace ! ( "Configuring MAC algorithms: {algos}" ) ;
200200 if let Err ( err) = session. method_pref ( SshMethodType :: MacCs , algos. as_str ( ) ) {
201- error ! ( "Could not set MAC algorithms (client-server): {}" , err ) ;
201+ error ! ( "Could not set MAC algorithms (client-server): {err}" ) ;
202202 return Err ( RemoteError :: new_ex ( RemoteErrorType :: ProtocolError , err) ) ;
203203 }
204204 if let Err ( err) = session. method_pref ( SshMethodType :: MacSc , algos. as_str ( ) ) {
205- error ! ( "Could not set MAC algorithms (server-client): {}" , err ) ;
205+ error ! ( "Could not set MAC algorithms (server-client): {err}" ) ;
206206 return Err ( RemoteError :: new_ex ( RemoteErrorType :: ProtocolError , err) ) ;
207207 }
208208
@@ -278,7 +278,7 @@ fn session_auth_with_rsakey(
278278 password : Option < & str > ,
279279 identity_file : Option < & [ PathBuf ] > ,
280280) -> RemoteResult < ( ) > {
281- debug ! ( "Authenticating with username '{}' and RSA key" , username ) ;
281+ debug ! ( "Authenticating with username '{username }' and RSA key" ) ;
282282 let mut keys = vec ! [ private_key] ;
283283 if let Some ( identity_file) = identity_file {
284284 let other_keys: Vec < & Path > = identity_file. iter ( ) . map ( |x| x. as_path ( ) ) . collect ( ) ;
@@ -293,7 +293,7 @@ fn session_auth_with_rsakey(
293293 return Ok ( ( ) ) ;
294294 }
295295 Err ( err) => {
296- error ! ( "Authentication failed: {}" , err ) ;
296+ error ! ( "Authentication failed: {err}" ) ;
297297 }
298298 }
299299 }
@@ -331,9 +331,9 @@ fn session_auth_with_password(
331331 password : & str ,
332332) -> RemoteResult < ( ) > {
333333 // Username / password
334- debug ! ( "Authenticating with username '{}' and password" , username ) ;
334+ debug ! ( "Authenticating with username '{username }' and password" ) ;
335335 if let Err ( err) = session. userauth_password ( username, password) {
336- error ! ( "Authentication failed: {}" , err ) ;
336+ error ! ( "Authentication failed: {err}" ) ;
337337 Err ( RemoteError :: new_ex (
338338 RemoteErrorType :: AuthenticationFailed ,
339339 err,
@@ -371,7 +371,7 @@ pub fn perform_shell_cmd<S: AsRef<str>>(session: &mut Session, cmd: S) -> Remote
371371 Ok ( _) => {
372372 // Wait close
373373 let _ = channel. wait_close ( ) ;
374- trace ! ( "Command output: {}" , output ) ;
374+ trace ! ( "Command output: {output}" ) ;
375375 Ok ( output)
376376 }
377377 Err ( err) => Err ( RemoteError :: new_ex (
@@ -397,9 +397,9 @@ pub fn perform_shell_cmd_with_rc<S: AsRef<str>>(
397397) -> RemoteResult < ( u32 , String ) > {
398398 let output = perform_shell_cmd ( session, format ! ( "{}; echo $?" , cmd. as_ref( ) ) ) ?;
399399 if let Some ( index) = output. trim ( ) . rfind ( '\n' ) {
400- trace ! ( "Read from stdout: '{}'" , output ) ;
400+ trace ! ( "Read from stdout: '{output }'" ) ;
401401 let actual_output = ( output[ 0 ..index + 1 ] ) . to_string ( ) ;
402- trace ! ( "Actual output '{}'" , actual_output ) ;
402+ trace ! ( "Actual output '{actual_output }'" ) ;
403403 trace ! ( "Parsing return code '{}'" , output[ index..] . trim( ) ) ;
404404 let rc = match u32:: from_str ( output[ index..] . trim ( ) ) . ok ( ) {
405405 Some ( val) => val,
@@ -410,7 +410,7 @@ pub fn perform_shell_cmd_with_rc<S: AsRef<str>>(
410410 ) ) ;
411411 }
412412 } ;
413- debug ! ( r#"Command output: "{}"; exit code: {}"# , actual_output , rc ) ;
413+ debug ! ( r#"Command output: "{actual_output }"; exit code: {rc }"# ) ;
414414 Ok ( ( rc, actual_output) )
415415 } else {
416416 match u32:: from_str ( output. trim ( ) ) . ok ( ) {
@@ -446,7 +446,7 @@ mod test {
446446 . password ( "password" ) ;
447447
448448 if let Err ( err) = connect ( & opts) {
449- panic ! ( "Could not connect to server: {}" , err ) ;
449+ panic ! ( "Could not connect to server: {err}" ) ;
450450 }
451451 let session = connect ( & opts) . unwrap ( ) ;
452452 assert ! ( session. authenticated( ) ) ;
0 commit comments