Skip to content

Commit

Permalink
Remove not needed returns
Browse files Browse the repository at this point in the history
Reason:
	In Rust in such cases `return` is redundant,
	remove it and the semicolon at the EOL
	and the value will be returned
  • Loading branch information
Bogdan Arabadzhi authored and xcambar committed Oct 18, 2017
1 parent 484e45b commit 830d0b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/precmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ use clap::{ArgMatches, App, SubCommand};

fn first_char(s: &str) -> String {
let chars: Vec<char> = s.chars().collect();
return match chars.len() {
match chars.len() {
0 => String::from(""),
_ => chars[0].to_string(),
};
}
}

fn fmt_current_path(cwd: &str) -> String {
Expand Down Expand Up @@ -61,7 +61,8 @@ fn repo_status(r: Repository) -> String {
if is_dirty == true {
out.push(Red.bold().paint("*"));
}
return ANSIStrings(&out).to_string();

ANSIStrings(&out).to_string()
}

pub fn display(_sub: &ArgMatches) {
Expand All @@ -80,4 +81,4 @@ pub fn display(_sub: &ArgMatches) {

pub fn cli_arguments<'a>() -> App<'a, 'a> {
SubCommand::with_name("precmd")
}
}
10 changes: 5 additions & 5 deletions src/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const COMMAND_SYMBOL:&str = "⬢";
pub fn display(sub_matches: &ArgMatches) {
let last_return_code = sub_matches.value_of("last_return_code").unwrap();
let keymap = sub_matches.value_of("keymap").unwrap();


let symbol = match keymap {
"vicmd" => COMMAND_SYMBOL,
_ => INSERT_SYMBOL,
Expand All @@ -23,7 +23,7 @@ pub fn display(sub_matches: &ArgMatches) {
}

pub fn cli_arguments<'a>() -> App<'a, 'a> {
return SubCommand::with_name("prompt")
SubCommand::with_name("prompt")
.arg(
Arg::with_name("last_return_code")
.short("r")
Expand All @@ -33,5 +33,5 @@ pub fn cli_arguments<'a>() -> App<'a, 'a> {
Arg::with_name("keymap")
.short("k")
.takes_value(true)
);
}
)
}

0 comments on commit 830d0b6

Please sign in to comment.