From d5534ca9db4f18a707ee7bc3edc1eb70647dca3b Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Wed, 29 Aug 2018 07:46:03 -0500 Subject: [PATCH] bring back sugg::range --- clippy_lints/src/utils/sugg.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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()`).