@@ -169,9 +169,9 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
169
169
kind : Kind )
170
170
-> CargoResult < ( ) > {
171
171
let rustflags = env_args ( self . config ,
172
- & self . build_config ,
173
- kind,
174
- "RUSTFLAGS" ) ?;
172
+ & self . build_config ,
173
+ kind,
174
+ "RUSTFLAGS" ) ?;
175
175
let mut process = self . config . rustc ( ) ?. process ( ) ;
176
176
process. arg ( "-" )
177
177
. arg ( "--crate-name" ) . arg ( "___" )
@@ -613,17 +613,10 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
613
613
match self . get_package ( id) {
614
614
Ok ( pkg) => {
615
615
pkg. targets ( ) . iter ( ) . find ( |t| t. is_lib ( ) ) . map ( |t| {
616
- let profile = if unit. profile . check &&
617
- !t. is_custom_build ( )
618
- && !t. for_host ( ) {
619
- & self . profiles . check
620
- } else {
621
- self . lib_profile ( )
622
- } ;
623
616
let unit = Unit {
624
617
pkg : pkg,
625
618
target : t,
626
- profile : profile ,
619
+ profile : self . lib_or_check_profile ( unit , t ) ,
627
620
kind : unit. kind . for_target ( t) ,
628
621
} ;
629
622
Ok ( unit)
@@ -780,7 +773,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
780
773
Unit {
781
774
pkg : unit. pkg ,
782
775
target : t,
783
- profile : self . lib_profile ( ) ,
776
+ profile : self . lib_or_check_profile ( unit , t ) ,
784
777
kind : unit. kind . for_target ( t) ,
785
778
}
786
779
} )
@@ -848,6 +841,14 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
848
841
}
849
842
}
850
843
844
+ pub fn lib_or_check_profile ( & self , unit : & Unit , target : & Target ) -> & ' a Profile {
845
+ if unit. profile . check && !target. is_custom_build ( ) && !target. for_host ( ) {
846
+ & self . profiles . check
847
+ } else {
848
+ self . lib_profile ( )
849
+ }
850
+ }
851
+
851
852
pub fn build_script_profile ( & self , _pkg : & PackageId ) -> & ' a Profile {
852
853
// TODO: should build scripts always be built with the same library
853
854
// profile? How is this controlled at the CLI layer?
0 commit comments