From fb02df7adbcb4e17b70aef52345d073e83ce700a Mon Sep 17 00:00:00 2001 From: rushiiMachine <33725716+rushiiMachine@users.noreply.github.com> Date: Tue, 24 Dec 2024 22:57:37 -0800 Subject: [PATCH] refactor: cleanup misc --- .editorconfig | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ .gitattributes | 1 + src/main.rs | 9 ++------ 3 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitattributes diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..444950b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,56 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +tab_width = 4 +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 100 +trim_trailing_whitespace = true +ij_continuation_indent_size = 4 +ij_formatter_tags_enabled = true +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.rs] +ij_rust_keep_line_breaks = true + +[{*.markdown,*.md}] +indent_size = 2 +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_insert_quote_arrows_on_wrap = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_keep_line_breaks_inside_text_blocks = true +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 +ij_markdown_wrap_text_if_long = true +ij_markdown_wrap_text_inside_blockquotes = true + +[*.yml] +tab_width = 2 +indent_size = 2 +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true + +[*.lock] +ij_formatter_enabled = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..94f480d --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 2c0d974..011c2e1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,9 +5,9 @@ use std::{env, fs, io, panic}; use ini::Ini; use seahorse::{App, Command, Context, Flag, FlagType}; -mod shortcuts; -mod osu_util; mod icons; +mod osu_util; +mod shortcuts; fn main() { let osu_flag = Flag::new("osu", FlagType::String) @@ -117,8 +117,6 @@ fn switch(ctx: &Context) { println!("Switching to {server}!"); let system_username = whoami::username(); - println!("Running for user {system_username}"); - let osu_cfg = format!("{osu_dir}/osu!.{system_username}.cfg"); let osu_exe = format!("{osu_dir}/osu!.exe"); let osu_db = format!("{osu_dir}/osu!.db"); @@ -145,9 +143,6 @@ fn switch(ctx: &Context) { let mut osu_ini = Ini::load_from_file(&osu_cfg) .expect(&format!("Failed to read osu!.{system_username}.cfg")); - // rust trickery - // .section() returns an immutable reference, - // as long as its in scope I cannot borrow as a mutable reference using .with_section later let (old_server, current_username, current_password) = { let cfg = osu_ini.section(None::) .expect("Corrupted osu user config");