From 0edcbc937cc68407d61cfd38cb11b902d013563c Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 13 Apr 2018 19:48:16 +0200 Subject: [PATCH] Remove host_triple() method from Context Favor accessing cx.build_config directly. --- src/cargo/core/compiler/context/mod.rs | 9 ++------- src/cargo/core/compiler/custom_build.rs | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/cargo/core/compiler/context/mod.rs b/src/cargo/core/compiler/context/mod.rs index 8caf02dc5..db78623a3 100644 --- a/src/cargo/core/compiler/context/mod.rs +++ b/src/cargo/core/compiler/context/mod.rs @@ -401,18 +401,13 @@ impl<'a, 'cfg> Context<'a, 'cfg> { self.files.as_mut().unwrap() } - /// Return the host triple for this context - pub fn host_triple(&self) -> &str { - &self.build_config.host_triple - } - /// Return the target triple which this context is targeting. pub fn target_triple(&self) -> &str { self.build_config .requested_target .as_ref() .map(|s| &s[..]) - .unwrap_or_else(|| self.host_triple()) + .unwrap_or_else(|| &self.build_config.host_triple) } /// Return the filenames that the given target for the given profile will @@ -456,7 +451,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { None => return true, }; let (name, info) = match kind { - Kind::Host => (self.host_triple(), &self.host_info), + Kind::Host => (self.build_config.host_triple.as_ref(), &self.host_info), Kind::Target => (self.target_triple(), &self.target_info), }; platform.matches(name, info.cfg()) diff --git a/src/cargo/core/compiler/custom_build.rs b/src/cargo/core/compiler/custom_build.rs index e007c998b..35d9e79bc 100644 --- a/src/cargo/core/compiler/custom_build.rs +++ b/src/cargo/core/compiler/custom_build.rs @@ -127,7 +127,7 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoRes .env( "TARGET", &match unit.kind { - Kind::Host => cx.host_triple(), + Kind::Host => &cx.build_config.host_triple, Kind::Target => cx.target_triple(), }, ) @@ -141,7 +141,7 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoRes "debug" }, ) - .env("HOST", cx.host_triple()) + .env("HOST", &cx.build_config.host_triple) .env("RUSTC", &cx.config.rustc()?.path) .env("RUSTDOC", &*cx.config.rustdoc()?) .inherit_jobserver(&cx.jobserver); -- 2.30.2