mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
&Self
This commit is contained in:
parent
be7c4b4862
commit
c102d50ece
2 changed files with 7 additions and 7 deletions
|
@ -134,7 +134,7 @@ fn check_collapsible_no_if_let(cx: &EarlyContext, expr: &ast::Expr, check: &ast:
|
|||
db.span_suggestion(expr.span,
|
||||
"try",
|
||||
format!("if {} {}",
|
||||
lhs.and(rhs),
|
||||
lhs.and(&rhs),
|
||||
snippet_block(cx, content.span, "..")));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use rustc::hir;
|
||||
use rustc::lint::{EarlyContext, LateContext, LintContext};
|
||||
use rustc_errors;
|
||||
use std::borrow::{Borrow, Cow};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::Display;
|
||||
use std;
|
||||
use syntax::codemap::{CharPos, Span};
|
||||
|
@ -136,8 +136,8 @@ impl<'a> Sugg<'a> {
|
|||
}
|
||||
|
||||
/// Convenience method to create the `<lhs> && <rhs>` suggestion.
|
||||
pub fn and<R: Borrow<Self>>(self, rhs: R) -> Sugg<'static> {
|
||||
make_binop(ast::BinOpKind::And, &self, rhs.borrow())
|
||||
pub fn and(self, rhs: &Self) -> Sugg<'static> {
|
||||
make_binop(ast::BinOpKind::And, &self, rhs)
|
||||
}
|
||||
|
||||
/// Convenience method to create the `<lhs> as <rhs>` suggestion.
|
||||
|
@ -162,10 +162,10 @@ impl<'a> Sugg<'a> {
|
|||
|
||||
/// Convenience method to create the `<lhs>..<rhs>` or `<lhs>...<rhs>`
|
||||
/// suggestion.
|
||||
pub fn range<E: Borrow<Self>>(self, end: E, limit: ast::RangeLimits) -> Sugg<'static> {
|
||||
pub fn range(self, end: &Self, limit: ast::RangeLimits) -> Sugg<'static> {
|
||||
match limit {
|
||||
ast::RangeLimits::HalfOpen => make_assoc(AssocOp::DotDot, &self, end.borrow()),
|
||||
ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotEq, &self, end.borrow()),
|
||||
ast::RangeLimits::HalfOpen => make_assoc(AssocOp::DotDot, &self, end),
|
||||
ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotEq, &self, end),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue