Skip to content

Commit d5534ca

Browse files
committed
bring back sugg::range
1 parent 05f637c commit d5534ca

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

clippy_lints/src/utils/sugg.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@ impl<'a> Sugg<'a> {
175175
make_unop("&mut *", self)
176176
}
177177

178+
/// Convenience method to create the `<lhs>..<rhs>` or `<lhs>...<rhs>`
179+
/// suggestion.
180+
#[allow(dead_code)]
181+
pub fn range(self, end: &Self, limit: ast::RangeLimits) -> Sugg<'static> {
182+
match limit {
183+
ast::RangeLimits::HalfOpen => make_assoc(AssocOp::DotDot, &self, end),
184+
ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotEq, &self, end),
185+
}
186+
}
187+
178188
/// Add parenthesis to any expression that might need them. Suitable to the
179189
/// `self` argument of
180190
/// a method call (eg. to build `bar.foo()` or `(1 + 2).foo()`).

0 commit comments

Comments
 (0)