Skip to content

Commit 8bfd645

Browse files
committed
A few small cleanups for newtype_index
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
1 parent d679764 commit 8bfd645

File tree

35 files changed

+68
-115
lines changed

35 files changed

+68
-115
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,8 +2556,7 @@ pub enum AttrStyle {
25562556
rustc_index::newtype_index! {
25572557
#[custom_encodable]
25582558
#[debug_format = "AttrId({})]"]
2559-
pub struct AttrId {
2560-
}
2559+
pub struct AttrId {}
25612560
}
25622561

25632562
impl<S: Encoder> Encodable<S> for AttrId {

compiler/rustc_ast/src/node_id.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ rustc_index::newtype_index! {
99
///
1010
/// [`DefId`]: rustc_span::def_id::DefId
1111
#[debug_format = "NodeId({})"]
12-
pub struct NodeId {
13-
}
12+
pub struct NodeId {}
1413
}
1514

1615
rustc_data_structures::define_id_collections!(NodeMap, NodeSet, NodeMapEntry, NodeId);

compiler/rustc_borrowck/src/constraints/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,10 @@ impl<'tcx> fmt::Debug for OutlivesConstraint<'tcx> {
116116

117117
rustc_index::newtype_index! {
118118
#[debug_format = "OutlivesConstraintIndex({})"]
119-
pub struct OutlivesConstraintIndex {
120-
}
119+
pub struct OutlivesConstraintIndex {}
121120
}
122121

123122
rustc_index::newtype_index! {
124123
#[debug_format = "ConstraintSccIndex({})"]
125-
pub struct ConstraintSccIndex {
126-
}
124+
pub struct ConstraintSccIndex {}
127125
}

compiler/rustc_borrowck/src/dataflow.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ impl_visitable! {
109109

110110
rustc_index::newtype_index! {
111111
#[debug_format = "bw{}"]
112-
pub struct BorrowIndex {
113-
}
112+
pub struct BorrowIndex {}
114113
}
115114

116115
/// `Borrows` stores the data used in the analyses that track the flow

compiler/rustc_borrowck/src/location.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ pub struct LocationTable {
2121

2222
rustc_index::newtype_index! {
2323
#[debug_format = "LocationIndex({})"]
24-
pub struct LocationIndex {
25-
}
24+
pub struct LocationIndex {}
2625
}
2726

2827
#[derive(Copy, Clone, Debug)]

compiler/rustc_borrowck/src/member_constraints.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ pub(crate) struct NllMemberConstraint<'tcx> {
5656

5757
rustc_index::newtype_index! {
5858
#[debug_format = "MemberConstraintIndex({})"]
59-
pub(crate) struct NllMemberConstraintIndex {
60-
}
59+
pub(crate) struct NllMemberConstraintIndex {}
6160
}
6261

6362
impl Default for MemberConstraintSet<'_, ty::RegionVid> {

compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct Appearance {
4646
}
4747

4848
rustc_index::newtype_index! {
49-
pub struct AppearanceIndex { .. }
49+
pub struct AppearanceIndex {}
5050
}
5151

5252
impl vll::LinkElem for Appearance {

compiler/rustc_data_structures/src/graph/dominators/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct PreOrderFrame<Iter> {
2222
}
2323

2424
rustc_index::newtype_index! {
25-
struct PreorderIndex { .. }
25+
struct PreorderIndex {}
2626
}
2727

2828
pub fn dominators<G: ControlFlowGraph>(graph: G) -> Dominators<G::Node> {

compiler/rustc_hir/src/hir_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ rustc_index::newtype_index! {
138138
/// an "item-like" to something else can be implemented by a `Vec` instead of a
139139
/// tree or hash map.
140140
#[derive(HashStable_Generic)]
141-
pub struct ItemLocalId { .. }
141+
pub struct ItemLocalId {}
142142
}
143143

144144
impl ItemLocalId {

compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
199199

200200
rustc_index::newtype_index! {
201201
#[custom_encodable]
202-
pub struct RegionId {
203-
}
202+
pub struct RegionId {}
204203
}
204+
205205
struct ConnectedRegion {
206206
idents: SmallVec<[Symbol; 8]>,
207207
impl_blocks: FxHashSet<usize>,

0 commit comments

Comments
 (0)