bring back sugg::range

This commit is contained in:
Corey Farwell 2018-08-29 07:46:03 -05:00
parent 05f637cf88
commit d5534ca9db

View File

@ -175,6 +175,16 @@ impl<'a> Sugg<'a> {
make_unop("&mut *", self)
}
/// Convenience method to create the `<lhs>..<rhs>` or `<lhs>...<rhs>`
/// 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()`).