Skip to content

Commit 6be6374

Browse files
committed
fix: clippy
1 parent 459eda1 commit 6be6374

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

russh-config/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ impl HostConfig {
7373
// Special-case IdentityFile param
7474
if let Some(right_identity_files) = right.identity_file.as_deref() {
7575
if let Some(identity_files) = left.identity_file.as_mut() {
76-
identity_files.extend(right_identity_files.into_iter().cloned())
76+
identity_files.extend(right_identity_files.iter().cloned())
7777
} else {
78-
left.identity_file = Some(Vec::from_iter(right_identity_files.into_iter().cloned()))
78+
left.identity_file = Some(Vec::from_iter(right_identity_files.iter().cloned()))
7979
}
8080
}
8181
left
@@ -107,7 +107,7 @@ impl HostEntry {
107107
matches = true;
108108
}
109109
}
110-
return matches;
110+
matches
111111
}
112112
}
113113

@@ -151,20 +151,20 @@ impl Config {
151151
fn user(&self) -> String {
152152
self.user
153153
.as_deref()
154-
.or_else(|| self.host_config.user.as_deref())
154+
.or(self.host_config.user.as_deref())
155155
.map(ToString::to_string)
156-
.unwrap_or_else(|| whoami::username())
156+
.unwrap_or_else(whoami::username)
157157
}
158158

159159
fn port(&self) -> u16 {
160-
self.host_config.port.or_else(|| self.port).unwrap_or(22)
160+
self.host_config.port.or(self.port).unwrap_or(22)
161161
}
162162

163163
fn host(&self) -> &str {
164164
self.host_config
165165
.hostname
166166
.as_ref()
167-
.unwrap_or_else(|| &self.host_name)
167+
.unwrap_or(&self.host_name)
168168
}
169169

170170
// Look for any of the ssh_config(5) percent-style tokens and expand them
@@ -174,8 +174,8 @@ impl Config {
174174
fn expand_tokens(&self, original: &str) -> String {
175175
let mut string = original.to_string();
176176
string = string.replace("%u", &self.user());
177-
string = string.replace("%h", &self.host()); // remote hostname (from context "host")
178-
string = string.replace("%H", &self.host()); // remote hostname (from context "host")
177+
string = string.replace("%h", self.host()); // remote hostname (from context "host")
178+
string = string.replace("%H", self.host()); // remote hostname (from context "host")
179179
string = string.replace("%p", &format!("{}", self.port())); // original typed hostname (from context "host")
180180
string = string.replace("%%", "%");
181181
string

0 commit comments

Comments
 (0)