@@ -94,7 +94,7 @@ impl BuildScriptOutput {
9494 }
9595
9696 /// Converts a [BufReader] into a vector of [BuildScriptOutput] enums.
97- fn from_reader < T : Read > ( mut reader : BufReader < T > ) -> Vec < BuildScriptOutput > {
97+ fn outputs_from_reader < T : Read > ( mut reader : BufReader < T > ) -> Vec < BuildScriptOutput > {
9898 let mut result = Vec :: < BuildScriptOutput > :: new ( ) ;
9999 let mut line = String :: new ( ) ;
100100 while reader. read_line ( & mut line) . expect ( "Cannot read line" ) != 0 {
@@ -107,20 +107,23 @@ impl BuildScriptOutput {
107107 }
108108
109109 /// Take a [Command], execute it and converts its input into a vector of [BuildScriptOutput]
110- pub fn from_command ( cmd : & mut Command ) -> Result < ( Vec < BuildScriptOutput > , Output ) , Output > {
110+ pub fn outputs_from_command (
111+ cmd : & mut Command ,
112+ ) -> Result < ( Vec < BuildScriptOutput > , Output ) , Output > {
111113 let child_output = cmd. output ( ) . expect ( "Unable to start binary" ) ;
112114 if child_output. status . success ( ) {
113115 let reader = BufReader :: new ( child_output. stdout . as_slice ( ) ) ;
114- let output = Self :: from_reader ( reader) ;
116+ let output = Self :: outputs_from_reader ( reader) ;
115117 Ok ( ( output, child_output) )
116118 } else {
117119 Err ( child_output)
118120 }
119121 }
120122
121123 /// Convert a vector of [BuildScriptOutput] into a list of environment variables.
122- pub fn to_env ( v : & Vec < BuildScriptOutput > , exec_root : & str ) -> String {
123- v. iter ( )
124+ pub fn outputs_to_env ( outputs : & [ BuildScriptOutput ] , exec_root : & str ) -> String {
125+ outputs
126+ . iter ( )
124127 . filter_map ( |x| {
125128 if let BuildScriptOutput :: Env ( env) = x {
126129 Some ( Self :: escape_for_serializing ( Self :: redact_exec_root (
@@ -135,9 +138,14 @@ impl BuildScriptOutput {
135138 }
136139
137140 /// Convert a vector of [BuildScriptOutput] into a list of dependencies environment variables.
138- pub fn to_dep_env ( v : & Vec < BuildScriptOutput > , crate_links : & str , exec_root : & str ) -> String {
141+ pub fn outputs_to_dep_env (
142+ outputs : & [ BuildScriptOutput ] ,
143+ crate_links : & str ,
144+ exec_root : & str ,
145+ ) -> String {
139146 let prefix = format ! ( "DEP_{}_" , crate_links. replace( "-" , "_" ) . to_uppercase( ) ) ;
140- v. iter ( )
147+ outputs
148+ . iter ( )
141149 . filter_map ( |x| {
142150 if let BuildScriptOutput :: DepEnv ( env) = x {
143151 Some ( format ! (
@@ -154,11 +162,11 @@ impl BuildScriptOutput {
154162 }
155163
156164 /// Convert a vector of [BuildScriptOutput] into a flagfile.
157- pub fn to_flags ( v : & Vec < BuildScriptOutput > , exec_root : & str ) -> CompileAndLinkFlags {
165+ pub fn outputs_to_flags ( outputs : & [ BuildScriptOutput ] , exec_root : & str ) -> CompileAndLinkFlags {
158166 let mut compile_flags = Vec :: new ( ) ;
159167 let mut link_flags = Vec :: new ( ) ;
160168
161- for flag in v {
169+ for flag in outputs {
162170 match flag {
163171 BuildScriptOutput :: Cfg ( e) => compile_flags. push ( format ! ( "--cfg={}" , e) ) ,
164172 BuildScriptOutput :: Flags ( e) => compile_flags. push ( e. to_owned ( ) ) ,
@@ -214,7 +222,7 @@ cargo:rustc-env=SOME_PATH=/some/absolute/path/beep
214222" ,
215223 ) ;
216224 let reader = BufReader :: new ( buff) ;
217- let result = BuildScriptOutput :: from_reader ( reader) ;
225+ let result = BuildScriptOutput :: outputs_from_reader ( reader) ;
218226 assert_eq ! ( result. len( ) , 10 ) ;
219227 assert_eq ! ( result[ 0 ] , BuildScriptOutput :: LinkLib ( "sdfsdf" . to_owned( ) ) ) ;
220228 assert_eq ! ( result[ 1 ] , BuildScriptOutput :: Env ( "FOO=BAR" . to_owned( ) ) ) ;
@@ -242,15 +250,15 @@ cargo:rustc-env=SOME_PATH=/some/absolute/path/beep
242250 ) ;
243251
244252 assert_eq ! (
245- BuildScriptOutput :: to_dep_env ( & result, "ssh2" , "/some/absolute/path" ) ,
253+ BuildScriptOutput :: outputs_to_dep_env ( & result, "ssh2" , "/some/absolute/path" ) ,
246254 "DEP_SSH2_VERSION=123\n DEP_SSH2_VERSION_NUMBER=1010107f\n DEP_SSH2_INCLUDE_PATH=${pwd}/include" . to_owned( )
247255 ) ;
248256 assert_eq ! (
249- BuildScriptOutput :: to_env ( & result, "/some/absolute/path" ) ,
257+ BuildScriptOutput :: outputs_to_env ( & result, "/some/absolute/path" ) ,
250258 "FOO=BAR\n BAR=FOO\n SOME_PATH=${pwd}/beep" . to_owned( )
251259 ) ;
252260 assert_eq ! (
253- BuildScriptOutput :: to_flags ( & result, "/some/absolute/path" ) ,
261+ BuildScriptOutput :: outputs_to_flags ( & result, "/some/absolute/path" ) ,
254262 CompileAndLinkFlags {
255263 // -Lblah was output as a rustc-flags, so even though it probably _should_ be a link
256264 // flag, we don't treat it like one.
0 commit comments