about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-07-01 10:55:43 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-07-01 10:55:57 +0200
commitfcfac05657acf387392f853904c917ac06c082c5 (patch)
tree445ddb2010f2f3fec4a6d500102a2d743e7917cd /src
parentb5b97dccaeb764c7dc0e7877941808acabb1cc8c (diff)
downloadrust-fcfac05657acf387392f853904c917ac06c082c5.tar.gz
rust-fcfac05657acf387392f853904c917ac06c082c5.zip
Improve `target` method API in `run-make-support`
Diffstat (limited to 'src')
-rw-r--r--src/tools/run-make-support/src/rustc.rs3
-rw-r--r--src/tools/run-make-support/src/rustdoc.rs3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs
index df843d74fc9..3f23c1b8f9e 100644
--- a/src/tools/run-make-support/src/rustc.rs
+++ b/src/tools/run-make-support/src/rustc.rs
@@ -201,7 +201,8 @@ impl Rustc {
     }
 
     /// Specify the target triple, or a path to a custom target json spec file.
-    pub fn target(&mut self, target: &str) -> &mut Self {
+    pub fn target<S: AsRef<str>>(&mut self, target: S) -> &mut Self {
+        let target = target.as_ref();
         self.cmd.arg(format!("--target={target}"));
         self
     }
diff --git a/src/tools/run-make-support/src/rustdoc.rs b/src/tools/run-make-support/src/rustdoc.rs
index fb00427b1c1..2be962ad888 100644
--- a/src/tools/run-make-support/src/rustdoc.rs
+++ b/src/tools/run-make-support/src/rustdoc.rs
@@ -104,7 +104,8 @@ impl Rustdoc {
     }
 
     /// Specify the target triple, or a path to a custom target json spec file.
-    pub fn target(&mut self, target: &str) -> &mut Self {
+    pub fn target<S: AsRef<str>>(&mut self, target: S) -> &mut Self {
+        let target = target.as_ref();
         self.cmd.arg(format!("--target={target}"));
         self
     }