Skip to content

Commit 471ac7f

Browse files
committed
feat: add util function to help format ast::RangeEnd
1 parent c075033 commit 471ac7f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/utils.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ pub(crate) fn format_pinnedness_and_mutability(
146146
}
147147
}
148148

149+
#[inline]
150+
pub(crate) fn format_range_end(end: ast::RangeEnd) -> &'static str {
151+
match end {
152+
ast::RangeEnd::Included(ast::RangeSyntax::DotDotDot) => "...",
153+
ast::RangeEnd::Included(ast::RangeSyntax::DotDotEq) => "..=",
154+
ast::RangeEnd::Excluded => "..",
155+
}
156+
}
157+
149158
#[inline]
150159
pub(crate) fn format_extern(ext: ast::Extern, explicit_abi: bool) -> Cow<'static, str> {
151160
match ext {

0 commit comments

Comments
 (0)