Skip to content

Commit 4b45e73

Browse files
committed
submodules: update clippy from c0dbd34 to 7b2a7a2
Changes: ```` Fix wrong lifetime of TyCtxt travis: Wait at most 30 minutes for base test Typos and minor grammar corrections Adds lint for integer division redundant_closure_for_method_calls fixes: lint does not trigger when there is a difference in mutability lint does not trigger when the method belongs to a trait which is not implemebted directly (Deref) Fix implicit_return docs rustup https://github.com/rust-lang/rust/pull/61758/files Remove wrong lifetime from LintContext Workaround for rust-lang/rustfmt#3615 Fixing eta with respect to lazy evaluation. ````
1 parent 598db50 commit 4b45e73

27 files changed

+205
-79
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ script:
9898
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
9999
- |
100100
if [ -z ${INTEGRATION} ]; then
101-
./ci/base-tests.sh && sleep 5
101+
travis_wait 30 ./ci/base-tests.sh && sleep 5
102102
else
103103
./ci/integration-tests.sh && sleep 5
104104
fi

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,7 @@ All notable changes to this project will be documented in this file.
956956
[`inline_fn_without_body`]: https://rust-lang.github.io/rust-clippy/master/index.html#inline_fn_without_body
957957
[`int_plus_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#int_plus_one
958958
[`integer_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic
959+
[`integer_division`]: https://rust-lang.github.io/rust-clippy/master/index.html#integer_division
959960
[`into_iter_on_array`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_array
960961
[`into_iter_on_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
961962
[`invalid_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_ref

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
99

10-
[There are 304 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
10+
[There are 305 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1111

1212
We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:
1313

clippy_lints/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ declare_clippy_lint! {
134134

135135
declare_clippy_lint! {
136136
/// **What it does:** Checks for `allow`/`warn`/`deny`/`forbid` attributes with scoped clippy
137-
/// lints and if those lints exist in clippy. If there is a uppercase letter in the lint name
137+
/// lints and if those lints exist in clippy. If there is an uppercase letter in the lint name
138138
/// (not the tool name) and a lowercase version of this lint exists, it will suggest to lowercase
139139
/// the lint name.
140140
///

clippy_lints/src/cognitive_complexity.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ impl CognitiveComplexity {
7474
let ret_adjust = if match_type(cx, ret_ty, &paths::RESULT) {
7575
returns
7676
} else {
77-
returns / 2
77+
#[allow(clippy::integer_division)]
78+
(returns / 2)
7879
};
7980

8081
if cc + divergence < match_arms + short_circuits {

clippy_lints/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl Hash for Constant {
121121
}
122122

123123
impl Constant {
124-
pub fn partial_cmp(tcx: TyCtxt<'_, '_, '_>, cmp_type: Ty<'_>, left: &Self, right: &Self) -> Option<Ordering> {
124+
pub fn partial_cmp(tcx: TyCtxt<'_, '_>, cmp_type: Ty<'_>, left: &Self, right: &Self) -> Option<Ordering> {
125125
match (left, right) {
126126
(&Constant::Str(ref ls), &Constant::Str(ref rs)) => Some(ls.cmp(rs)),
127127
(&Constant::Char(ref l), &Constant::Char(ref r)) => Some(l.cmp(r)),

clippy_lints/src/double_comparison.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use syntax::source_map::Span;
99
use crate::utils::{snippet_with_applicability, span_lint_and_sugg, SpanlessEq};
1010

1111
declare_clippy_lint! {
12-
/// **What it does:** Checks for double comparions that could be simplified to a single expression.
12+
/// **What it does:** Checks for double comparisons that could be simplified to a single expression.
1313
///
1414
///
1515
/// **Why is this bad?** Readability.

clippy_lints/src/eta_reduction.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ use rustc::ty::{self, Ty};
66
use rustc::{declare_lint_pass, declare_tool_lint};
77
use rustc_errors::Applicability;
88

9-
use crate::utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then, type_is_unsafe_function};
9+
use crate::utils::{
10+
implements_trait, is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then, type_is_unsafe_function,
11+
};
1012

1113
declare_clippy_lint! {
1214
/// **What it does:** Checks for closures which just call another function where
@@ -82,6 +84,8 @@ fn check_closure(cx: &LateContext<'_, '_>, expr: &Expr) {
8284
if_chain!(
8385
if let ExprKind::Call(ref caller, ref args) = ex.node;
8486

87+
if let ExprKind::Path(_) = caller.node;
88+
8589
// Not the same number of arguments, there is no way the closure is the same as the function return;
8690
if args.len() == decl.inputs.len();
8791

@@ -150,7 +154,9 @@ fn get_ufcs_type_name(
150154
let actual_type_of_self = &cx.tables.node_type(self_arg.hir_id);
151155

152156
if let Some(trait_id) = cx.tcx.trait_of_item(method_def_id) {
153-
if match_borrow_depth(expected_type_of_self, &actual_type_of_self) {
157+
if match_borrow_depth(expected_type_of_self, &actual_type_of_self)
158+
&& implements_trait(cx, actual_type_of_self, trait_id, &[])
159+
{
154160
return Some(cx.tcx.def_path_str(trait_id));
155161
}
156162
}
@@ -166,7 +172,7 @@ fn get_ufcs_type_name(
166172

167173
fn match_borrow_depth(lhs: Ty<'_>, rhs: Ty<'_>) -> bool {
168174
match (&lhs.sty, &rhs.sty) {
169-
(ty::Ref(_, t1, _), ty::Ref(_, t2, _)) => match_borrow_depth(&t1, &t2),
175+
(ty::Ref(_, t1, mut1), ty::Ref(_, t2, mut2)) => mut1 == mut2 && match_borrow_depth(&t1, &t2),
170176
(l, r) => match (l, r) {
171177
(ty::Ref(_, _, _), _) | (_, ty::Ref(_, _, _)) => false,
172178
(_, _) => true,
@@ -181,9 +187,8 @@ fn match_types(lhs: Ty<'_>, rhs: Ty<'_>) -> bool {
181187
| (ty::Int(_), ty::Int(_))
182188
| (ty::Uint(_), ty::Uint(_))
183189
| (ty::Str, ty::Str) => true,
184-
(ty::Ref(_, t1, _), ty::Ref(_, t2, _))
185-
| (ty::Array(t1, _), ty::Array(t2, _))
186-
| (ty::Slice(t1), ty::Slice(t2)) => match_types(t1, t2),
190+
(ty::Ref(_, t1, mut1), ty::Ref(_, t2, mut2)) => mut1 == mut2 && match_types(t1, t2),
191+
(ty::Array(t1, _), ty::Array(t2, _)) | (ty::Slice(t1), ty::Slice(t2)) => match_types(t1, t2),
187192
(ty::Adt(def1, _), ty::Adt(def2, _)) => def1 == def2,
188193
(_, _) => false,
189194
}

clippy_lints/src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UselessFormat {
9292
}
9393
}
9494

95-
fn span_useless_format<'a, 'tcx: 'a, T: LintContext<'tcx>>(cx: &'a T, span: Span, help: &str, mut sugg: String) {
95+
fn span_useless_format<T: LintContext>(cx: &T, span: Span, help: &str, mut sugg: String) {
9696
let to_replace = span.source_callsite();
9797

9898
// The callsite span contains the statement semicolon for some reason.

clippy_lints/src/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ declare_clippy_lint! {
5656
}
5757

5858
declare_clippy_lint! {
59-
/// **What it does:** Checks for public functions that dereferences raw pointer
59+
/// **What it does:** Checks for public functions that dereference raw pointer
6060
/// arguments but are not marked unsafe.
6161
///
6262
/// **Why is this bad?** The function should probably be marked `unsafe`, since

0 commit comments

Comments
 (0)