Skip to content

Commit 8fac41a

Browse files
Clean up code a bit:
* Remove "bool_to_options" feature * Update version for compiler feature * rustfmt
1 parent 56e5f61 commit 8fac41a

File tree

7 files changed

+25
-17
lines changed

7 files changed

+25
-17
lines changed

compiler/rustc_feature/src/active.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ declare_features! (
676676
(active, closure_track_caller, "1.57.0", Some(87417), None),
677677

678678
/// Allows `#[doc(cfg_hide(...))]`.
679-
(active, doc_cfg_hide, "1.53.0", Some(43781), None),
679+
(active, doc_cfg_hide, "1.57.0", Some(43781), None),
680680

681681
// -------------------------------------------------------------------------
682682
// feature-group-end: actual feature gates

library/alloc/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@
6565
#![doc(
6666
html_playground_url = "https://play.rust-lang.org/",
6767
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
68-
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))),
68+
test(no_crate_inject, attr(allow(unused_variables), deny(warnings)))
6969
)]
70-
#![cfg_attr(not(bootstrap),
70+
#![cfg_attr(
71+
not(bootstrap),
7172
doc(cfg_hide(not(test), not(any(test, bootstrap)), target_has_atomic = "ptr"))
7273
)]
7374
#![no_std]

library/core/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@
5858
html_playground_url = "https://play.rust-lang.org/",
5959
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
6060
test(no_crate_inject, attr(deny(warnings))),
61-
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))),
61+
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
6262
)]
63-
#![cfg_attr(not(bootstrap),
63+
#![cfg_attr(
64+
not(bootstrap),
6465
doc(cfg_hide(
6566
not(test),
6667
target_pointer_width = "16",

library/std/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,9 @@
193193
html_playground_url = "https://play.rust-lang.org/",
194194
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
195195
test(no_crate_inject, attr(deny(warnings))),
196-
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))),
197-
)]
198-
#![cfg_attr(not(bootstrap),
199-
doc(cfg_hide(not(test), not(any(test, bootstrap))))
196+
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
200197
)]
198+
#![cfg_attr(not(bootstrap), doc(cfg_hide(not(test), not(any(test, bootstrap)))))]
201199
// Don't link to std. We are std.
202200
#![no_std]
203201
#![warn(deprecated_in_future)]

src/librustdoc/clean/types.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,9 @@ impl AttributesExt for [ast::Attribute] {
786786
fn single(self) -> Option<Self::Item> {
787787
let mut iter = self.into_iter();
788788
let item = iter.next()?;
789-
iter.next().is_none().then_some(())?;
789+
if iter.next().is_some() {
790+
return None;
791+
}
790792
Some(item)
791793
}
792794
}
@@ -802,16 +804,19 @@ impl AttributesExt for [ast::Attribute] {
802804
if doc_cfg.peek().is_some() {
803805
doc_cfg
804806
.filter_map(|attr| {
805-
Cfg::parse(&attr).map_err(|e| sess.diagnostic().span_err(e.span, e.msg)).ok()
807+
Cfg::parse(&attr)
808+
.map_err(|e| sess.diagnostic().span_err(e.span, e.msg))
809+
.ok()
806810
})
807811
.fold(Cfg::True, |cfg, new_cfg| cfg & new_cfg)
808812
} else {
809-
self
810-
.iter()
813+
self.iter()
811814
.filter(|attr| attr.has_name(sym::cfg))
812815
.filter_map(|attr| Some(attr.meta_item_list()?.single()?.meta_item()?.clone()))
813816
.filter_map(|attr| {
814-
Cfg::parse(&attr).map_err(|e| sess.diagnostic().span_err(e.span, e.msg)).ok()
817+
Cfg::parse(&attr)
818+
.map_err(|e| sess.diagnostic().span_err(e.span, e.msg))
819+
.ok()
815820
})
816821
.filter(|cfg| !hidden_cfg.contains(cfg))
817822
.fold(Cfg::True, |cfg, new_cfg| cfg & new_cfg)

src/librustdoc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#![feature(rustc_private)]
66
#![feature(array_methods)]
77
#![feature(assert_matches)]
8-
#![feature(bool_to_option)]
98
#![feature(box_patterns)]
109
#![feature(control_flow_enum)]
1110
#![feature(box_syntax)]

src/librustdoc/visit_ast.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
44
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
55
use rustc_hir as hir;
6-
use rustc_hir::CRATE_HIR_ID;
76
use rustc_hir::def::{DefKind, Res};
87
use rustc_hir::def_id::DefId;
98
use rustc_hir::Node;
9+
use rustc_hir::CRATE_HIR_ID;
1010
use rustc_middle::middle::privacy::AccessLevel;
1111
use rustc_middle::ty::TyCtxt;
1212
use rustc_span;
@@ -99,7 +99,11 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
9999
}
100100
}
101101

102-
self.cx.cache.hidden_cfg = self.cx.tcx.hir().attrs(CRATE_HIR_ID)
102+
self.cx.cache.hidden_cfg = self
103+
.cx
104+
.tcx
105+
.hir()
106+
.attrs(CRATE_HIR_ID)
103107
.iter()
104108
.filter(|attr| attr.has_name(sym::doc))
105109
.flat_map(|attr| attr.meta_item_list().into_iter().flatten())

0 commit comments

Comments
 (0)