Fix test
This commit is contained in:
parent
cad33c0306
commit
be7c4b4862
@ -45,6 +45,7 @@ impl LintPass for IntPlusOne {
|
|||||||
// x + 1 <= y
|
// x + 1 <= y
|
||||||
// x <= y - 1
|
// x <= y - 1
|
||||||
|
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
enum Side {
|
enum Side {
|
||||||
LHS,
|
LHS,
|
||||||
RHS,
|
RHS,
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::lint::{EarlyContext, LateContext, LintContext};
|
use rustc::lint::{EarlyContext, LateContext, LintContext};
|
||||||
use rustc_errors;
|
use rustc_errors;
|
||||||
use std::borrow::Cow;
|
use std::borrow::{Borrow, Cow};
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std;
|
use std;
|
||||||
use syntax::codemap::{CharPos, Span};
|
use syntax::codemap::{CharPos, Span};
|
||||||
@ -136,8 +136,8 @@ impl<'a> Sugg<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience method to create the `<lhs> && <rhs>` suggestion.
|
/// Convenience method to create the `<lhs> && <rhs>` suggestion.
|
||||||
pub fn and(self, rhs: Self) -> Sugg<'static> {
|
pub fn and<R: Borrow<Self>>(self, rhs: R) -> Sugg<'static> {
|
||||||
make_binop(ast::BinOpKind::And, &self, &rhs)
|
make_binop(ast::BinOpKind::And, &self, rhs.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience method to create the `<lhs> as <rhs>` suggestion.
|
/// 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>`
|
/// Convenience method to create the `<lhs>..<rhs>` or `<lhs>...<rhs>`
|
||||||
/// suggestion.
|
/// suggestion.
|
||||||
pub fn range(self, end: Self, limit: ast::RangeLimits) -> Sugg<'static> {
|
pub fn range<E: Borrow<Self>>(self, end: E, limit: ast::RangeLimits) -> Sugg<'static> {
|
||||||
match limit {
|
match limit {
|
||||||
ast::RangeLimits::HalfOpen => make_assoc(AssocOp::DotDot, &self, &end),
|
ast::RangeLimits::HalfOpen => make_assoc(AssocOp::DotDot, &self, end.borrow()),
|
||||||
ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotEq, &self, &end),
|
ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotEq, &self, end.borrow()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
|
|
||||||
|
|
||||||
#![warn(clippy, clippy_pedantic)]
|
#![warn(clippy, clippy_pedantic)]
|
||||||
#![allow(blacklisted_name, unused, print_stdout, non_ascii_literal, new_without_default, new_without_default_derive, missing_docs_in_private_items)]
|
#![allow(blacklisted_name, unused, print_stdout, non_ascii_literal, new_without_default,
|
||||||
|
new_without_default_derive, missing_docs_in_private_items, needless_pass_by_value)]
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user