Clean up whitespace

This commit is contained in:
Philip Kristoffersen
2022-04-28 23:39:23 +02:00
parent 29ad5ee2e7
commit 8e9cbd8652
4 changed files with 87 additions and 81 deletions
+9 -6
View File
@@ -184,12 +184,12 @@ impl MyEguiApp {
.unwrap_or(&mut empty_string);
let mut auth_key_clipboard = false;
ui.label("Authentication key: ");
if let Ok(mut clipboard_ctx) = copypasta::ClipboardContext::new(){
if let Ok(content) = clipboard_ctx.get_contents(){
if auth_key.is_empty() && looks_like_auth_key(&content) {
if let Ok(mut clipboard_ctx) = copypasta::ClipboardContext::new() {
if let Ok(content) = clipboard_ctx.get_contents() {
if auth_key.is_empty() && looks_like_auth_key(&content) {
*auth_key = content.clone();
auth_key_clipboard = true;
}else if content.eq(auth_key){
} else if content.eq(auth_key) {
auth_key_clipboard = true;
}
}
@@ -197,7 +197,7 @@ impl MyEguiApp {
if ui.text_edit_singleline(auth_key).changed() {
self.settings.steamgrid_db.auth_key = Some(auth_key.to_string());
}
if auth_key_clipboard{
if auth_key_clipboard {
ui.label("Found API Key in clipboard");
}
});
@@ -292,5 +292,8 @@ impl MyEguiApp {
}
fn looks_like_auth_key(content: &String) -> bool {
content.len() == 32 && content.is_ascii() && content.chars().all(char::is_alphanumeric) && content.chars().all(char::is_lowercase)
content.len() == 32
&& content.is_ascii()
&& content.chars().all(char::is_alphanumeric)
&& content.chars().all(char::is_lowercase)
}