Simplify implied_target_features.

Currently its argument is an iterator, but in practice it's always a
singleton.
This commit is contained in:
Nicholas Nethercote 2025-02-25 14:13:16 +11:00
parent 1df93fd6a7
commit 2df8e657f2
4 changed files with 10 additions and 12 deletions

View file

@ -360,7 +360,7 @@ pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<S
#[allow(rustc::potential_query_instability)]
features.extend(
sess.target
.implied_target_features(std::iter::once(feature.as_str()))
.implied_target_features(feature.as_str())
.iter()
.map(|s| Symbol::intern(s)),
);
@ -373,7 +373,7 @@ pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec<S
features.retain(|f| {
if sess
.target
.implied_target_features(std::iter::once(f.as_str()))
.implied_target_features(f.as_str())
.contains(&feature.as_str())
{
// If `f` if implies `feature`, then `!feature` implies `!f`, so we have to
@ -681,7 +681,7 @@ pub(crate) fn global_llvm_features(
for feature in sess.opts.cg.target_feature.split(',') {
if let Some(feature) = feature.strip_prefix('+') {
all_rust_features.extend(
UnordSet::from(sess.target.implied_target_features(std::iter::once(feature)))
UnordSet::from(sess.target.implied_target_features(feature))
.to_sorted_stable_ord()
.iter()
.map(|&&s| (true, s)),