&str instead of weird &String

This commit is contained in:
Stephan Dilly 2021-09-02 19:19:09 +02:00
parent 6f2157c1d8
commit aaf0e4cfbf
6 changed files with 9 additions and 13 deletions

View file

@ -179,7 +179,7 @@ impl CommitComponent {
anyhow::bail!("config commit.gpgsign=true detected.\ngpg signing not supported.\ndeactivate in your repo/gitconfig to be able to commit without signing."); anyhow::bail!("config commit.gpgsign=true detected.\ngpg signing not supported.\ndeactivate in your repo/gitconfig to be able to commit without signing.");
} }
let msg = self.input.get_text().clone(); let msg = self.input.get_text().to_string();
self.input.clear(); self.input.clear();
self.commit_with_msg(msg) self.commit_with_msg(msg)
} }

View file

@ -122,8 +122,7 @@ impl CreateBranchComponent {
/// ///
pub fn create_branch(&mut self) { pub fn create_branch(&mut self) {
let res = let res = sync::create_branch(CWD, self.input.get_text());
sync::create_branch(CWD, self.input.get_text().as_str());
self.input.clear(); self.input.clear();
self.hide(); self.hide();

View file

@ -119,7 +119,7 @@ impl Component for CredComponent {
Some( Some(
self.input_username self.input_username
.get_text() .get_text()
.clone(), .to_string(),
), ),
None, None,
); );
@ -131,7 +131,7 @@ impl Component for CredComponent {
Some( Some(
self.input_password self.input_password
.get_text() .get_text()
.clone(), .to_string(),
), ),
); );
self.input_password.hide(); self.input_password.hide();

View file

@ -127,11 +127,8 @@ impl RenameBranchComponent {
/// ///
pub fn rename_branch(&mut self) { pub fn rename_branch(&mut self) {
if let Some(br) = &self.branch_ref { if let Some(br) = &self.branch_ref {
let res = sync::rename_branch( let res =
CWD, sync::rename_branch(CWD, br, self.input.get_text());
br,
self.input.get_text().as_str(),
);
match res { match res {
Ok(_) => { Ok(_) => {

View file

@ -68,7 +68,7 @@ impl Component for StashMsgComponent {
if self.input.get_text().is_empty() { if self.input.get_text().is_empty() {
None None
} else { } else {
Some(self.input.get_text().as_str()) Some(self.input.get_text())
}, },
self.options.stash_untracked, self.options.stash_untracked,
self.options.keep_index, self.options.keep_index,

View file

@ -81,8 +81,8 @@ impl TextInputComponent {
} }
/// Get the `msg`. /// Get the `msg`.
pub const fn get_text(&self) -> &String { pub fn get_text(&self) -> &str {
&self.msg self.msg.as_str()
} }
/// screen area (last time we got drawn) /// screen area (last time we got drawn)