Skip to content

Commit d29ac15

Browse files
committed
Remove unused code
1 parent 70f3821 commit d29ac15

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

src/cargo/core/compiler/context/mod.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -206,19 +206,21 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
206206

207207
// If the unit has a build script, add `OUT_DIR` to the
208208
// environment variables.
209-
for dep in &self.bcx.unit_graph[unit] {
210-
if dep.unit.mode.is_run_custom_build() {
211-
let out_dir = self
212-
.files()
213-
.build_script_out_dir(&dep.unit)
214-
.display()
215-
.to_string();
216-
let script_meta = self.get_run_build_script_metadata(&dep.unit);
217-
self.compilation
218-
.extra_env
219-
.entry(script_meta)
220-
.or_insert_with(Vec::new)
221-
.push(("OUT_DIR".to_string(), out_dir));
209+
if unit.target.is_lib() {
210+
for dep in &self.bcx.unit_graph[unit] {
211+
if dep.unit.mode.is_run_custom_build() {
212+
let out_dir = self
213+
.files()
214+
.build_script_out_dir(&dep.unit)
215+
.display()
216+
.to_string();
217+
let script_meta = self.get_run_build_script_metadata(&dep.unit);
218+
self.compilation
219+
.extra_env
220+
.entry(script_meta)
221+
.or_insert_with(Vec::new)
222+
.push(("OUT_DIR".to_string(), out_dir));
223+
}
222224
}
223225
}
224226

src/cargo/core/compiler/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod job;
1212
mod job_queue;
1313
mod layout;
1414
mod links;
15-
pub mod lto;
15+
mod lto;
1616
mod output_depinfo;
1717
pub mod rustdoc;
1818
pub mod standard_lib;

src/cargo/ops/cargo_compile.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@
2525
use std::collections::{BTreeSet, HashMap, HashSet};
2626
use std::ffi::OsString;
2727
use std::hash::{Hash, Hasher};
28-
use std::iter;
2928
use std::sync::Arc;
3029

31-
use crate::core::compiler::lto;
3230
use crate::core::compiler::unit_dependencies::build_unit_dependencies;
3331
use crate::core::compiler::unit_graph::{self, UnitDep, UnitGraph};
34-
use crate::core::compiler::Layout;
3532
use crate::core::compiler::{standard_lib, TargetInfo};
3633
use crate::core::compiler::{BuildConfig, BuildContext, Compilation, Context};
3734
use crate::core::compiler::{CompileKind, CompileMode, CompileTarget, RustcTargetData, Unit};

0 commit comments

Comments
 (0)