Skip to content

Commit 2b5ddf4

Browse files
committed
Removing redundancies in string usage
1 parent daa59b4 commit 2b5ddf4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: src/info.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl std::fmt::Display for Info {
4545
let username = if self.git_username == "" {
4646
String::from("")
4747
}else{
48-
String::from(format!("{}:",self.git_username))
48+
format!("{}:",self.git_username)
4949
};
5050

5151
let git_info = format!("{}{}", username, self.git_version);
@@ -284,8 +284,7 @@ impl Info {
284284
.arg("--version")
285285
.output()
286286
.expect("Failed to execute git.");
287-
let version = String::from_utf8_lossy(&version.stdout);
288-
let version = version.to_string().replace('\n',"");
287+
let version = String::from_utf8_lossy(&version.stdout).replace('\n',"");
289288

290289
let username = Command::new("git")
291290
.arg("-C")
@@ -295,8 +294,7 @@ impl Info {
295294
.arg("user.name")
296295
.output()
297296
.expect("Failed to execute git.");
298-
let username = String::from_utf8_lossy(&username.stdout);
299-
let username = username.to_string().replace('\n',"");
297+
let username = String::from_utf8_lossy(&username.stdout).replace('\n',"");
300298
(version, username)
301299
}
302300

0 commit comments

Comments
 (0)