File tree 3 files changed +23
-25
lines changed
3 files changed +23
-25
lines changed Original file line number Diff line number Diff line change
1
+ # https://rust-lang.github.io/rustfmt/?version=master&search=fn_call_#use_small_heuristics
1
2
hard_tabs = true
2
3
max_width = 120
3
- array_width = 80
4
4
fn_call_width = 80
5
5
attr_fn_like_width = 80
6
- chain_width = 80
7
6
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
Original file line number Diff line number Diff line change @@ -51,26 +51,25 @@ const CONFIG_FILE_NAME: &str = "ww.ron";
51
51
impl Config {
52
52
pub fn get ( ) -> Self {
53
53
let mut config = Self :: default ( ) ;
54
+
54
55
let path = Self :: get_path ( ) ;
56
+ let Ok ( file) = fs:: read_to_string ( & path) else { return config } ;
55
57
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
+ } ;
74
73
75
74
config
76
75
}
Original file line number Diff line number Diff line change @@ -44,11 +44,7 @@ pub fn style_number(mut num: i32, sub: bool) -> String {
44
44
let mut result = String :: new ( ) ;
45
45
46
46
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 ] } ) ;
52
48
return result;
53
49
}
54
50
You can’t perform that action at this time.
0 commit comments