From 6bbf832cf266e48c1e8773e5d64a7e90bd866c7b Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sun, 24 Nov 2024 01:23:19 +0100 Subject: [PATCH] Remove unnecessary 0 link args optimization --- compiler/rustc_codegen_ssa/src/back/linker.rs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index 162ea38dfd5..05dfbd40a0a 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -183,15 +183,7 @@ fn verbatim_args( } /// Add underlying linker arguments to C compiler command, by wrapping them in /// `-Wl` or `-Xlinker`. -fn convert_link_args_to_cc_args( - cmd: &mut Command, - args: impl IntoIterator, IntoIter: ExactSizeIterator>, -) { - let args = args.into_iter(); - if args.len() == 0 { - return; - } - +fn convert_link_args_to_cc_args(cmd: &mut Command, args: impl IntoIterator>) { let mut combined_arg = OsString::from("-Wl"); for arg in args { // If the argument itself contains a comma, we need to emit it @@ -220,10 +212,7 @@ fn convert_link_args_to_cc_args( } /// Arguments for the underlying linker. /// Add options to pass them through cc wrapper if `Linker` is a cc wrapper. -fn link_args( - l: &mut L, - args: impl IntoIterator, IntoIter: ExactSizeIterator>, -) -> &mut L { +fn link_args(l: &mut L, args: impl IntoIterator>) -> &mut L { if !l.is_cc() { verbatim_args(l, args); } else { @@ -257,7 +246,7 @@ macro_rules! generate_arg_methods { verbatim_args(self, iter::once(arg)) } #[allow(unused)] - pub(crate) fn link_args(&mut self, args: impl IntoIterator, IntoIter: ExactSizeIterator>) -> &mut Self { + pub(crate) fn link_args(&mut self, args: impl IntoIterator>) -> &mut Self { link_args(self, args) } #[allow(unused)]