Skip to content

Commit aaf0e4c

Browse files
author
Stephan Dilly
committed
&str instead of weird &String
1 parent 6f2157c commit aaf0e4c

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

src/components/commit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl CommitComponent {
179179
anyhow::bail!("config commit.gpgsign=true detected.\ngpg signing not supported.\ndeactivate in your repo/gitconfig to be able to commit without signing.");
180180
}
181181

182-
let msg = self.input.get_text().clone();
182+
let msg = self.input.get_text().to_string();
183183
self.input.clear();
184184
self.commit_with_msg(msg)
185185
}

src/components/create_branch.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ impl CreateBranchComponent {
122122

123123
///
124124
pub fn create_branch(&mut self) {
125-
let res =
126-
sync::create_branch(CWD, self.input.get_text().as_str());
125+
let res = sync::create_branch(CWD, self.input.get_text());
127126

128127
self.input.clear();
129128
self.hide();

src/components/cred.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl Component for CredComponent {
119119
Some(
120120
self.input_username
121121
.get_text()
122-
.clone(),
122+
.to_string(),
123123
),
124124
None,
125125
);
@@ -131,7 +131,7 @@ impl Component for CredComponent {
131131
Some(
132132
self.input_password
133133
.get_text()
134-
.clone(),
134+
.to_string(),
135135
),
136136
);
137137
self.input_password.hide();

src/components/rename_branch.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,8 @@ impl RenameBranchComponent {
127127
///
128128
pub fn rename_branch(&mut self) {
129129
if let Some(br) = &self.branch_ref {
130-
let res = sync::rename_branch(
131-
CWD,
132-
br,
133-
self.input.get_text().as_str(),
134-
);
130+
let res =
131+
sync::rename_branch(CWD, br, self.input.get_text());
135132

136133
match res {
137134
Ok(_) => {

src/components/stashmsg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl Component for StashMsgComponent {
6868
if self.input.get_text().is_empty() {
6969
None
7070
} else {
71-
Some(self.input.get_text().as_str())
71+
Some(self.input.get_text())
7272
},
7373
self.options.stash_untracked,
7474
self.options.keep_index,

src/components/textinput.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ impl TextInputComponent {
8181
}
8282

8383
/// Get the `msg`.
84-
pub const fn get_text(&self) -> &String {
85-
&self.msg
84+
pub fn get_text(&self) -> &str {
85+
self.msg.as_str()
8686
}
8787

8888
/// screen area (last time we got drawn)

0 commit comments

Comments
 (0)