File tree Expand file tree Collapse file tree 2 files changed +18
-23
lines changed Expand file tree Collapse file tree 2 files changed +18
-23
lines changed Original file line number Diff line number Diff line change @@ -155,8 +155,24 @@ impl<'de, 'gctx> de::Deserializer<'de> for Deserializer<'gctx> {
155155 V : de:: Visitor < ' de > ,
156156 {
157157 if name == "StringList" {
158- let vals = self . gctx . get_list_or_string ( & self . key ) ?;
159- let vals: Vec < String > = vals. into_iter ( ) . map ( |vd| vd. 0 ) . collect ( ) ;
158+ let mut res = Vec :: new ( ) ;
159+
160+ match self . gctx . get_cv ( & self . key ) ? {
161+ Some ( CV :: List ( val, _def) ) => res. extend ( val) ,
162+ Some ( CV :: String ( val, def) ) => {
163+ let split_vs = val. split_whitespace ( ) . map ( |s| ( s. to_string ( ) , def. clone ( ) ) ) ;
164+ res. extend ( split_vs) ;
165+ }
166+ Some ( val) => {
167+ self . gctx
168+ . expected ( "string or array of strings" , & self . key , & val) ?;
169+ }
170+ None => { }
171+ }
172+
173+ self . gctx . get_env_list ( & self . key , & mut res) ?;
174+
175+ let vals: Vec < String > = res. into_iter ( ) . map ( |vd| vd. 0 ) . collect ( ) ;
160176 visitor. visit_newtype_struct ( vals. into_deserializer ( ) )
161177 } else {
162178 visitor. visit_newtype_struct ( self )
Original file line number Diff line number Diff line change @@ -1006,27 +1006,6 @@ impl GlobalContext {
10061006 }
10071007 }
10081008
1009- /// Helper for `StringList` type to get something that is a string or list.
1010- fn get_list_or_string ( & self , key : & ConfigKey ) -> CargoResult < Vec < ( String , Definition ) > > {
1011- let mut res = Vec :: new ( ) ;
1012-
1013- match self . get_cv ( key) ? {
1014- Some ( CV :: List ( val, _def) ) => res. extend ( val) ,
1015- Some ( CV :: String ( val, def) ) => {
1016- let split_vs = val. split_whitespace ( ) . map ( |s| ( s. to_string ( ) , def. clone ( ) ) ) ;
1017- res. extend ( split_vs) ;
1018- }
1019- Some ( val) => {
1020- return self . expected ( "string or array of strings" , key, & val) ;
1021- }
1022- None => { }
1023- }
1024-
1025- self . get_env_list ( key, & mut res) ?;
1026-
1027- Ok ( res)
1028- }
1029-
10301009 /// Internal method for getting an environment variable as a list.
10311010 /// If the key is a non-mergeable list and a value is found in the environment, existing values are cleared.
10321011 fn get_env_list (
You can’t perform that action at this time.
0 commit comments