Skip to content

Commit 0120646

Browse files
authored
Merge pull request #2 from ttytm/main
update
2 parents cf9e8c2 + 6733c8d commit 0120646

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

rustfmt.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
# https://rust-lang.github.io/rustfmt/?version=master&search=fn_call_#use_small_heuristics
12
hard_tabs = true
23
max_width = 120
3-
array_width = 80
44
fn_call_width = 80
55
attr_fn_like_width = 80
6-
chain_width = 80
76
struct_lit_width = 36
7+
array_width = 80
8+
chain_width = 80
9+
single_line_if_else_max_width = 80
10+
single_line_let_else_max_width = 80

src/modules/config.rs

+17-18
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,25 @@ const CONFIG_FILE_NAME: &str = "ww.ron";
5151
impl Config {
5252
pub fn get() -> Self {
5353
let mut config = Self::default();
54+
5455
let path = Self::get_path();
56+
let Ok(file) = fs::read_to_string(&path) else { return config };
5557

56-
if let Ok(file) = fs::read_to_string(&path) {
57-
match Options::default()
58-
.with_default_extension(Extensions::IMPLICIT_SOME)
59-
.from_str::<ConfigFile>(&file)
60-
{
61-
Ok(contents) => contents.apply_to(&mut config),
62-
Err(error) => {
63-
let warning_sign = style(" Warning:").yellow();
64-
eprintln!(
65-
"{warning_sign} {}\n{: >4}At: {error}.\n{: >4}Falling back to default values.\n",
66-
path.display(),
67-
"",
68-
"",
69-
);
70-
return config;
71-
}
72-
};
73-
}
58+
match Options::default()
59+
.with_default_extension(Extensions::IMPLICIT_SOME)
60+
.from_str::<ConfigFile>(&file)
61+
{
62+
Ok(contents) => contents.apply_to(&mut config),
63+
Err(error) => {
64+
let warning = style(" Warning:").yellow();
65+
eprintln!(
66+
"{warning} {0}\n{1: >4}At: {error}.\n{1: >4}Falling back to default values.\n",
67+
path.display(),
68+
"",
69+
);
70+
return config;
71+
}
72+
};
7473

7574
config
7675
}

src/modules/display/utils.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ pub fn style_number(mut num: i32, sub: bool) -> String {
4444
let mut result = String::new();
4545

4646
if num == 0 {
47-
result.push(if sub {
48-
SUBSCRIPT_DIGITS[0]
49-
} else {
50-
SUPERSCRIPT_DIGITS[0]
51-
});
47+
result.push(if sub { SUBSCRIPT_DIGITS[0] } else { SUPERSCRIPT_DIGITS[0] });
5248
return result;
5349
}
5450

0 commit comments

Comments
 (0)