@@ -124,7 +124,7 @@ impl<'a> FileSearch<'a> {
124124 pub fn get_tools_search_paths ( & self ) -> Vec < PathBuf > {
125125 let mut p = PathBuf :: from ( self . sysroot ) ;
126126 p. push ( & find_libdir ( self . sysroot ) ) ;
127- p. push ( & rustlibdir ( ) ) ;
127+ p. push ( RUST_LIB_DIR ) ;
128128 p. push ( & self . triple ) ;
129129 p. push ( "bin" ) ;
130130 vec ! [ p]
@@ -134,7 +134,7 @@ impl<'a> FileSearch<'a> {
134134pub fn relative_target_lib_path ( sysroot : & Path , target_triple : & str ) -> PathBuf {
135135 let mut p = PathBuf :: from ( & find_libdir ( sysroot) ) ;
136136 assert ! ( p. is_relative( ) ) ;
137- p. push ( & rustlibdir ( ) ) ;
137+ p. push ( RUST_LIB_DIR ) ;
138138 p. push ( target_triple) ;
139139 p. push ( "lib" ) ;
140140 p
@@ -176,31 +176,23 @@ fn find_libdir(sysroot: &Path) -> String {
176176 // "lib" (i.e. non-default), this value is used (see issue #16552).
177177
178178 match option_env ! ( "CFG_LIBDIR_RELATIVE" ) {
179- Some ( libdir) if libdir != "lib" => return libdir. to_string ( ) ,
180- _ => if sysroot. join ( & primary_libdir_name ( ) ) . join ( & rustlibdir ( ) ) . exists ( ) {
181- return primary_libdir_name ( ) ;
179+ Some ( libdir) if libdir != "lib" => return libdir. into ( ) ,
180+ _ => if sysroot. join ( PRIMARY_LIB_DIR ) . join ( RUST_LIB_DIR ) . exists ( ) {
181+ return PRIMARY_LIB_DIR . into ( ) ;
182182 } else {
183- return secondary_libdir_name ( ) ;
183+ return SECONDARY_LIB_DIR . into ( ) ;
184184 }
185185 }
186186
187187 #[ cfg( target_pointer_width = "64" ) ]
188- fn primary_libdir_name ( ) -> String {
189- "lib64" . to_string ( )
190- }
188+ const PRIMARY_LIB_DIR : & ' static str = "lib64" ;
191189
192190 #[ cfg( target_pointer_width = "32" ) ]
193- fn primary_libdir_name ( ) -> String {
194- "lib32" . to_string ( )
195- }
191+ const PRIMARY_LIB_DIR : & ' static str = "lib32" ;
196192
197- fn secondary_libdir_name ( ) -> String {
198- "lib" . to_string ( )
199- }
193+ const SECONDARY_LIB_DIR : & ' static str = "lib" ;
200194}
201195
202196// The name of rustc's own place to organize libraries.
203197// Used to be "rustc", now the default is "rustlib"
204- pub fn rustlibdir ( ) -> String {
205- "rustlib" . to_string ( )
206- }
198+ const RUST_LIB_DIR : & ' static str = "rustlib" ;
0 commit comments