diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index a02e01447911..8b1b8a31ac22 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -175,6 +175,16 @@ impl<'a> Sugg<'a> { make_unop("&mut *", self) } + /// Convenience method to create the `..` or `...` + /// suggestion. + #[allow(dead_code)] + pub fn range(self, end: &Self, limit: ast::RangeLimits) -> Sugg<'static> { + match limit { + ast::RangeLimits::HalfOpen => make_assoc(AssocOp::DotDot, &self, end), + ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotEq, &self, end), + } + } + /// Add parenthesis to any expression that might need them. Suitable to the /// `self` argument of /// a method call (eg. to build `bar.foo()` or `(1 + 2).foo()`).