Skip to content

Commit

Permalink
add clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
santhosh-chinnasamy committed Oct 12, 2024
1 parent ab35dd5 commit 3c8a635
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::{fs, process::exit};

use toml::Table;

const CONFIG_FOLDER: &'static str = ".config/cliq";
const CONFIG_FILE: &'static str = "cliq.toml";
const DEFAULT_CONFIG: &'static str = "
const CONFIG_FOLDER: &str = ".config/cliq";
const CONFIG_FILE: &str = "cliq.toml";
const DEFAULT_CONFIG: &str = "
[links]
google = \"https://google.com\"
hub = \"https://github.com\"
Expand All @@ -14,7 +14,7 @@ lab = \"https://gitlab.com\"
fn config_file() -> String {
let home_dir = dirs::home_dir().unwrap().to_str().unwrap().to_string();
let cliq_config = format!("{}/{}/{}", home_dir, CONFIG_FOLDER, CONFIG_FILE);
return cliq_config.to_string();
cliq_config.to_string()
}

fn create_config() {
Expand All @@ -35,7 +35,7 @@ fn read_config() -> Table {
create_config();
}

let cliq_config = match fs::read_to_string(&config_file()) {
let cliq_config = match fs::read_to_string(config_file()) {
Ok(file) => file,
Err(e) => {
eprintln!("Error reading cliq.toml. \nCreate cliq.toml file under $HOME/.config/cliq folder. {}", e);
Expand All @@ -44,13 +44,13 @@ fn read_config() -> Table {
};

let cliq_data: Table = cliq_config.parse().unwrap();
return cliq_data;
cliq_data
}

pub fn links() -> Table {
let cliq_data = read_config();
let links = cliq_data["links"].as_table().unwrap().clone();
return links;
links
}

pub fn link(alias: String) -> String {
Expand All @@ -63,5 +63,5 @@ pub fn link(alias: String) -> String {
}
};

return link.to_string();
link.to_string()
}
2 changes: 1 addition & 1 deletion src/browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn program() -> String {
_ => LINUX,
};

return _program.to_string();
_program.to_string()
}

pub fn open(url: String) {
Expand Down
8 changes: 4 additions & 4 deletions src/commands/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn get_current_branch() -> String {
.unwrap();

let branch = str::from_utf8(&result.stdout[..]).unwrap().to_string();
return branch;
branch
}

fn get_current_tag_name() -> String {
Expand All @@ -108,7 +108,7 @@ fn get_current_tag_name() -> String {
.unwrap();

let tag = str::from_utf8(&result.stdout[..]).unwrap().to_string();
return tag;
tag
}

fn get_current_commit_sha() -> String {
Expand All @@ -121,7 +121,7 @@ fn get_current_commit_sha() -> String {
.unwrap();

let commit_sha = str::from_utf8(&result.stdout[..]).unwrap().to_string();
return commit_sha;
commit_sha
}

fn get_branch_or_tag_or_commit() -> String {
Expand All @@ -130,7 +130,7 @@ fn get_branch_or_tag_or_commit() -> String {
let commit = get_current_commit_sha();

if !branch.is_empty() {
return branch;
branch
} else if !tag.is_empty() {
return tag;
} else if !commit.is_empty() {
Expand Down

0 comments on commit 3c8a635

Please sign in to comment.