Skip to content

Commit 86f40ac

Browse files
committed
Remove style() from AttributeExt trait
1 parent e51c37c commit 86f40ac

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,13 @@ impl AttributeExt for Attribute {
217217
_ => None,
218218
}
219219
}
220+
}
220221

221-
fn style(&self) -> AttrStyle {
222+
impl Attribute {
223+
pub fn style(&self) -> AttrStyle {
222224
self.style
223225
}
224-
}
225226

226-
impl Attribute {
227227
pub fn may_have_doc_links(&self) -> bool {
228228
self.doc_str().is_some_and(|s| comments::may_have_doc_links(s.as_str()))
229229
}
@@ -826,8 +826,6 @@ pub trait AttributeExt: Debug {
826826
/// commented module (for inner doc) vs within its parent module (for outer
827827
/// doc).
828828
fn doc_resolution_scope(&self) -> Option<AttrStyle>;
829-
830-
fn style(&self) -> AttrStyle;
831829
}
832830

833831
// FIXME(fn_delegation): use function delegation instead of manually forwarding
@@ -902,8 +900,4 @@ impl Attribute {
902900
pub fn doc_str_and_comment_kind(&self) -> Option<(Symbol, CommentKind)> {
903901
AttributeExt::doc_str_and_comment_kind(self)
904902
}
905-
906-
pub fn style(&self) -> AttrStyle {
907-
AttributeExt::style(self)
908-
}
909903
}

compiler/rustc_hir/src/hir.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,14 @@ pub enum Attribute {
12071207
}
12081208

12091209
impl Attribute {
1210+
pub fn style(&self) -> AttrStyle {
1211+
match &self {
1212+
Attribute::Unparsed(u) => u.style,
1213+
Attribute::Parsed(AttributeKind::DocComment { style, .. }) => *style,
1214+
_ => panic!(),
1215+
}
1216+
}
1217+
12101218
pub fn get_normal_item(&self) -> &AttrItem {
12111219
match &self {
12121220
Attribute::Unparsed(normal) => &normal,
@@ -1355,15 +1363,6 @@ impl AttributeExt for Attribute {
13551363
_ => None,
13561364
}
13571365
}
1358-
1359-
#[inline]
1360-
fn style(&self) -> AttrStyle {
1361-
match &self {
1362-
Attribute::Unparsed(u) => u.style,
1363-
Attribute::Parsed(AttributeKind::DocComment { style, .. }) => *style,
1364-
_ => panic!(),
1365-
}
1366-
}
13671366
}
13681367

13691368
// FIXME(fn_delegation): use function delegation instead of manually forwarding
@@ -1452,11 +1451,6 @@ impl Attribute {
14521451
pub fn doc_str_and_comment_kind(&self) -> Option<(Symbol, CommentKind)> {
14531452
AttributeExt::doc_str_and_comment_kind(self)
14541453
}
1455-
1456-
#[inline]
1457-
pub fn style(&self) -> AttrStyle {
1458-
AttributeExt::style(self)
1459-
}
14601454
}
14611455

14621456
/// Attributes owned by a HIR owner.

0 commit comments

Comments
 (0)