@smbcloud / cli / commits / fcfaffa

Clippy

Seto Elkahfi committed Apr 10, 2023 at 17:47 UTC fcfaffabd76339219544f60eb52d49be13d8aa62
5 files changed +12 -15
src/account/forgot/mod.rs
+3 -6
@@ -68,10 +68,7 @@ async fn input_code() -> Result<CommandResult> {
68 spinners::Spinners::SimpleDotsScrolling,
69 style("Checking your code...").green().bold().to_string(),
70 )
71 - .stop_and_persist(
72 - &"✅".to_owned(),
73 - "Great. Now input your new password.".to_owned(),
74 - );
71 + .stop_and_persist("✅", "Great. Now input your new password.".to_owned());
72
73 let new_password = Password::with_theme(&ColorfulTheme::default())
74 .with_prompt("Password")
@@ -103,11 +100,11 @@ async fn input_code() -> Result<CommandResult> {
100 user: User {
101 reset_password_token: security_code,
102 password: new_password,
106 - password_confirmation: password_confirmation,
103 + password_confirmation,
104 },
105 };
106
110 - let mut spinner = Spinner::new(
107 + let spinner = Spinner::new(
108 spinners::Spinners::SimpleDotsScrolling,
109 style("Updating your password...")
110 .green()
src/account/login/process.rs
+1 -1
@@ -132,7 +132,7 @@ pub async fn process_logout() -> Result<CommandResult> {
132 }
133 None => {
134 let error = anyhow!("Failed to get home directory. Are you logged in?");
135 - return Err(error);
135 + Err(error)
136 }
137 }
138 }
src/account/signup/process.rs
+3 -3
@@ -313,8 +313,8 @@ fn github_url_builder() -> URLBuilder {
313 url_builder
314 .set_protocol("https")
315 .set_host("github.com")
316 - .add_param("client_id", &client_id)
317 - .add_param("redirect_uri", &redirect_uri);
316 + .add_param("client_id", client_id)
317 + .add_param("redirect_uri", redirect_uri);
318 url_builder
319 }
320
@@ -334,7 +334,7 @@ fn build_github_access_token_url(code: String) -> String {
334 let mut url_builder = github_url_builder();
335 url_builder
336 .add_route("login/oauth/access_token")
337 - .add_param("client_secret", &client_secret)
337 + .add_param("client_secret", client_secret)
338 .add_param("code", &code);
339 url_builder.build()
340 }
src/projects/mod.rs
+4 -4
@@ -146,11 +146,11 @@ pub async fn process_projects(commands: Commands) -> Result<CommandResult> {
146 Ok(_) => Ok(CommandResult {
147 spinner,
148 symbol: "✅".to_owned(),
149 - msg: format!("Project deleted."),
149 + msg: "Project deleted.".to_string(),
150 }),
151 Err(e) => {
152 let error = anyhow!("Failed to delete project. {e}");
153 - return Err(error);
153 + Err(error)
154 }
155 }
156 }
@@ -178,12 +178,12 @@ pub async fn process_projects(commands: Commands) -> Result<CommandResult> {
178 Ok(CommandResult {
179 spinner,
180 symbol: "✅".to_owned(),
181 - msg: format!("Use project successful."),
181 + msg: "Use project successful.".to_string(),
182 })
183 }
184 None => {
185 let error = anyhow!("Failed to get home directory.");
186 - return Err(error);
186 + Err(error)
187 }
188 }
189 }
src/util.rs
+1 -1
@@ -23,7 +23,7 @@ pub struct CommandResult {
23 pub msg: String,
24 }
25
26 -pub fn email_validation(input: &String) -> Result<(), &'static str> {
26 +pub fn email_validation(input: &str) -> Result<(), &'static str> {
27 let email_regex = Regex::new(
28 r"^([a-z0-9_+]([a-z0-9_+.]*[a-z0-9_+])?)@([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6})",
29 )