@@ -18,16 +18,13 @@ fn increase_weight(old_w: f64, inc_w: f64) -> f64 {
1818fn decrease_weight ( old_w : f64 , dec_w : f64 ) -> f64 {
1919 let result = old_w - dec_w;
2020
21- if result < 0.0 {
22- 0.0
23- } else {
24- result
25- }
21+ if result < 0.0 { 0.0 } else { result }
2622}
2723
2824
2925fn do_increase < P > ( entries : & mut Vec < Entry > , p : P , w : f64 ) -> Entry
30- where P : AsRef < path:: Path > {
26+ where P : AsRef < path:: Path >
27+ {
3128 let p = p. as_ref ( ) ;
3229
3330 // don't process $HOME
@@ -54,7 +51,8 @@ fn do_increase<P>(entries: &mut Vec<Entry>, p: P, w: f64) -> Entry
5451
5552
5653fn do_increase_and_save < P > ( config : & Config , p : P , w : f64 ) -> Entry
57- where P : AsRef < path:: Path > {
54+ where P : AsRef < path:: Path >
55+ {
5856 let mut entries = data:: load ( config) ;
5957 let entry = do_increase ( & mut entries, p, w) ;
6058 data:: save ( config, & entries) . unwrap ( ) ;
@@ -63,7 +61,8 @@ fn do_increase_and_save<P>(config: &Config, p: P, w: f64) -> Entry
6361
6462
6563fn do_decrease < P > ( entries : & mut Vec < Entry > , p : P , w : f64 ) -> Entry
66- where P : AsRef < path:: Path > {
64+ where P : AsRef < path:: Path >
65+ {
6766 let p = p. as_ref ( ) ;
6867 for ent in entries. iter_mut ( ) {
6968 if ent. path == p {
@@ -83,7 +82,8 @@ fn do_decrease<P>(entries: &mut Vec<Entry>, p: P, w: f64) -> Entry
8382
8483
8584fn do_decrease_and_save < P > ( config : & Config , p : P , w : f64 ) -> Entry
86- where P : AsRef < path:: Path > {
85+ where P : AsRef < path:: Path >
86+ {
8787 let mut entries = data:: load ( config) ;
8888 let entry = do_decrease ( & mut entries, p, w) ;
8989 data:: save ( config, & entries) . unwrap ( ) ;
@@ -92,7 +92,8 @@ fn do_decrease_and_save<P>(config: &Config, p: P, w: f64) -> Entry
9292
9393
9494pub fn add < P > ( config : & Config , p : P )
95- where P : AsRef < path:: Path > {
95+ where P : AsRef < path:: Path >
96+ {
9697 do_increase_and_save ( config, p, DEFAULT_INCREASE_WEIGHT as f64 ) ;
9798}
9899
0 commit comments