@@ -27,7 +27,6 @@ pub(crate) struct CcBuilder {
27
27
output_lib_type : OutputLibType ,
28
28
}
29
29
30
- use cc;
31
30
use std:: { env, fs} ;
32
31
33
32
pub ( crate ) struct Library {
@@ -83,28 +82,29 @@ impl Default for PlatformConfig {
83
82
}
84
83
}
85
84
85
+ #[ allow( clippy:: upper_case_acronyms) ]
86
86
pub ( crate ) enum BuildOption {
87
87
STD ( String ) ,
88
88
FLAG ( String ) ,
89
89
DEFINE ( String , String ) ,
90
90
INCLUDE ( PathBuf ) ,
91
91
}
92
92
impl BuildOption {
93
- fn std < T : ToString > ( val : T ) -> Self {
93
+ fn std < T : ToString + ? Sized > ( val : & T ) -> Self {
94
94
Self :: STD ( val. to_string ( ) )
95
95
}
96
- fn flag < T : ToString > ( val : T ) -> Self {
96
+ fn flag < T : ToString + ? Sized > ( val : & T ) -> Self {
97
97
Self :: FLAG ( val. to_string ( ) )
98
98
}
99
- fn flag_if_supported < T : ToString > ( cc_build : & cc:: Build , flag : T ) -> Option < Self > {
99
+ fn flag_if_supported < T : ToString + ? Sized > ( cc_build : & cc:: Build , flag : & T ) -> Option < Self > {
100
100
if let Ok ( true ) = cc_build. is_flag_supported ( flag. to_string ( ) ) {
101
101
Some ( Self :: FLAG ( flag. to_string ( ) ) )
102
102
} else {
103
103
None
104
104
}
105
105
}
106
106
107
- fn define < K : ToString , V : ToString > ( key : K , val : V ) -> Self {
107
+ fn define < K : ToString + ? Sized , V : ToString + ? Sized > ( key : & K , val : & V ) -> Self {
108
108
Self :: DEFINE ( key. to_string ( ) , val. to_string ( ) )
109
109
}
110
110
@@ -222,13 +222,13 @@ impl CcBuilder {
222
222
let flag = format ! ( "-ffile-prefix-map={}=" , self . manifest_dir. display( ) ) ;
223
223
if let Ok ( true ) = cc_build. is_flag_supported ( & flag) {
224
224
emit_warning ( & format ! ( "Using flag: {}" , & flag) ) ;
225
- build_options. push ( BuildOption :: flag ( flag) ) ;
225
+ build_options. push ( BuildOption :: flag ( & flag) ) ;
226
226
} else {
227
227
emit_warning ( "NOTICE: Build environment source paths might be visible in release binary." ) ;
228
228
let flag = format ! ( "-fdebug-prefix-map={}=" , self . manifest_dir. display( ) ) ;
229
229
if let Ok ( true ) = cc_build. is_flag_supported ( & flag) {
230
230
emit_warning ( & format ! ( "Using flag: {}" , & flag) ) ;
231
- build_options. push ( BuildOption :: flag ( flag) ) ;
231
+ build_options. push ( BuildOption :: flag ( & flag) ) ;
232
232
}
233
233
}
234
234
}
@@ -241,12 +241,11 @@ impl CcBuilder {
241
241
// clang: error: overriding '-mmacosx-version-min=13.7' option with '--target=x86_64-apple-macosx14.2' [-Werror,-Woverriding-t-option]
242
242
// ```
243
243
if let Some ( option) =
244
- BuildOption :: flag_if_supported ( & cc_build, "-Wno-overriding-t-option" )
244
+ BuildOption :: flag_if_supported ( cc_build, "-Wno-overriding-t-option" )
245
245
{
246
246
build_options. push ( option) ;
247
247
}
248
- if let Some ( option) =
249
- BuildOption :: flag_if_supported ( & cc_build, "-Wno-overriding-option" )
248
+ if let Some ( option) = BuildOption :: flag_if_supported ( cc_build, "-Wno-overriding-option" )
250
249
{
251
250
build_options. push ( option) ;
252
251
}
0 commit comments