@@ -690,7 +690,7 @@ pub struct Config {
690690 root_ratoml : Option < GlobalLocalConfigInput > ,
691691
692692 /// For every `SourceRoot` there can be at most one RATOML file.
693- ratoml_files : FxHashMap < SourceRootId , GlobalLocalConfigInput > ,
693+ ratoml_files : FxHashMap < SourceRootId , LocalConfigInput > ,
694694
695695 /// Clone of the value that is stored inside a `GlobalState`.
696696 source_root_parent_map : Arc < FxHashMap < SourceRootId , SourceRootId > > ,
@@ -761,7 +761,7 @@ impl Config {
761761 if let Ok ( change) = toml:: from_str ( & text) {
762762 config. ratoml_files . insert (
763763 source_root_id,
764- GlobalLocalConfigInput :: from_toml ( change, & mut toml_errors) ,
764+ LocalConfigInput :: from_toml ( & change, & mut toml_errors) ,
765765 ) ;
766766 }
767767 }
@@ -2476,12 +2476,18 @@ macro_rules! _impl_for_config_data {
24762476 while let Some ( source_root_id) = par {
24772477 par = self . source_root_parent_map. get( & source_root_id) . copied( ) ;
24782478 if let Some ( config) = self . ratoml_files. get( & source_root_id) {
2479- if let Some ( value) = config. local . $field. as_ref( ) {
2479+ if let Some ( value) = config. $field. as_ref( ) {
24802480 return value;
24812481 }
24822482 }
24832483 }
24842484
2485+ if let Some ( root_path_ratoml) = self . root_ratoml. as_ref( ) {
2486+ if let Some ( v) = root_path_ratoml. local. $field. as_ref( ) {
2487+ return & v;
2488+ }
2489+ }
2490+
24852491 if let Some ( v) = self . client_config. local. $field. as_ref( ) {
24862492 return & v;
24872493 }
@@ -2612,7 +2618,7 @@ macro_rules! _config_data {
26122618 ) * }
26132619 }
26142620
2615- fn from_toml( toml: & mut toml:: Table , error_sink: & mut Vec <( String , toml:: de:: Error ) >) -> Self {
2621+ fn from_toml( toml: & toml:: Table , error_sink: & mut Vec <( String , toml:: de:: Error ) >) -> Self {
26162622 Self { $(
26172623 $field: get_field_toml:: <$ty>(
26182624 toml,
@@ -2681,7 +2687,6 @@ impl FullConfigInput {
26812687 GlobalConfigInput :: schema_fields ( & mut fields) ;
26822688 LocalConfigInput :: schema_fields ( & mut fields) ;
26832689 ClientConfigInput :: schema_fields ( & mut fields) ;
2684- // HACK: sort the fields, so the diffs on the generated docs/schema are smaller
26852690 fields. sort_by_key ( |& ( x, ..) | x) ;
26862691 fields
26872692 }
@@ -2707,12 +2712,12 @@ struct GlobalLocalConfigInput {
27072712
27082713impl GlobalLocalConfigInput {
27092714 fn from_toml (
2710- mut toml : toml:: Table ,
2715+ toml : toml:: Table ,
27112716 error_sink : & mut Vec < ( String , toml:: de:: Error ) > ,
27122717 ) -> GlobalLocalConfigInput {
27132718 GlobalLocalConfigInput {
2714- global : GlobalConfigInput :: from_toml ( & mut toml, error_sink) ,
2715- local : LocalConfigInput :: from_toml ( & mut toml, error_sink) ,
2719+ global : GlobalConfigInput :: from_toml ( & toml, error_sink) ,
2720+ local : LocalConfigInput :: from_toml ( & toml, error_sink) ,
27162721 }
27172722 }
27182723}
@@ -2730,14 +2735,11 @@ fn get_field_toml<T: DeserializeOwned>(
27302735 let subkeys = field. split ( '_' ) ;
27312736 let mut v = val;
27322737 for subkey in subkeys {
2733- if let Some ( val) = v. get ( subkey) {
2734- if let Some ( map) = val. as_table ( ) {
2735- v = map;
2736- } else {
2737- return Some ( toml:: Value :: try_into ( val. clone ( ) ) . map_err ( |e| ( e, v) ) ) ;
2738- }
2738+ let val = v. get ( subkey) ?;
2739+ if let Some ( map) = val. as_table ( ) {
2740+ v = map;
27392741 } else {
2740- return None ;
2742+ return Some ( toml :: Value :: try_into ( val . clone ( ) ) . map_err ( |e| ( e , v ) ) ) ;
27412743 }
27422744 }
27432745 None
0 commit comments