Skip to content

Commit 7de3a1d

Browse files
authored
Merge pull request rust-lang#2699 from mati865/rustup
rustup
2 parents 3b64402 + cc7d66a commit 7de3a1d

10 files changed

+61
-55
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ All notable changes to this project will be documented in this file.
615615
[`eq_op`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#eq_op
616616
[`erasing_op`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#erasing_op
617617
[`eval_order_dependence`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#eval_order_dependence
618+
[`excessive_precision`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#excessive_precision
618619
[`expl_impl_clone_on_copy`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#expl_impl_clone_on_copy
619620
[`explicit_counter_loop`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#explicit_counter_loop
620621
[`explicit_into_iter_loop`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#explicit_into_iter_loop
@@ -644,6 +645,7 @@ All notable changes to this project will be documented in this file.
644645
[`inconsistent_digit_grouping`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping
645646
[`indexing_slicing`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#indexing_slicing
646647
[`ineffective_bit_mask`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#ineffective_bit_mask
648+
[`infallible_destructuring_match`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#infallible_destructuring_match
647649
[`infinite_iter`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#infinite_iter
648650
[`inline_always`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#inline_always
649651
[`inline_fn_without_body`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#inline_fn_without_body

README.md

+1-1
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 255 lints included in this crate!](https://rust-lang-nursery.github.io/rust-clippy/master/index.html)
10+
[There are 257 lints included in this crate!](https://rust-lang-nursery.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/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc::ty;
55
use rustc::hir::def::Def;
66
use std::collections::HashSet;
77
use syntax::ast;
8-
use syntax::abi::Abi;
8+
use rustc_target::spec::abi::Abi;
99
use syntax::codemap::Span;
1010
use utils::{iter_input_pats, span_lint, type_is_unsafe_function};
1111

clippy_lints/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#[macro_use]
2020
extern crate rustc;
2121
extern crate rustc_typeck;
22+
extern crate rustc_target;
2223
extern crate syntax;
2324
extern crate syntax_pos;
2425

@@ -516,6 +517,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
516517
eta_reduction::REDUNDANT_CLOSURE,
517518
eval_order_dependence::DIVERGING_SUB_EXPRESSION,
518519
eval_order_dependence::EVAL_ORDER_DEPENDENCE,
520+
excessive_precision::EXCESSIVE_PRECISION,
519521
explicit_write::EXPLICIT_WRITE,
520522
format::USELESS_FORMAT,
521523
formatting::POSSIBLE_MISSING_COMMA,
@@ -692,6 +694,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
692694
enum_variants::MODULE_INCEPTION,
693695
eq_op::OP_REF,
694696
eta_reduction::REDUNDANT_CLOSURE,
697+
excessive_precision::EXCESSIVE_PRECISION,
695698
formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
696699
formatting::SUSPICIOUS_ELSE_FORMATTING,
697700
if_let_redundant_pattern_matching::IF_LET_REDUNDANT_PATTERN_MATCHING,

clippy_lints/src/needless_pass_by_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc::ty::{self, RegionKind, TypeFoldable};
66
use rustc::traits;
77
use rustc::middle::expr_use_visitor as euv;
88
use rustc::middle::mem_categorization as mc;
9-
use syntax::abi::Abi;
9+
use rustc_target::spec::abi::Abi;
1010
use syntax::ast::NodeId;
1111
use syntax_pos::Span;
1212
use syntax::errors::DiagnosticBuilder;

clippy_lints/src/utils/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc::hir::map::Node;
88
use rustc::lint::{LateContext, Level, Lint, LintContext};
99
use rustc::session::Session;
1010
use rustc::traits;
11-
use rustc::ty::{self, Ty, TyCtxt, layout};
11+
use rustc::ty::{self, Ty, TyCtxt, layout::{self, IntegerExt}};
1212
use rustc_errors;
1313
use std::borrow::Cow;
1414
use std::env;

mini-macro/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(proc_macro)]
1+
#![feature(proc_macro, proc_macro_non_items)]
22
extern crate proc_macro;
33

44
use proc_macro::{TokenStream, quote};

tests/ui/infallible_destructuring_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(exhaustive_patterns)]
1+
#![feature(exhaustive_patterns, never_type)]
22
#![allow(let_and_return)]
33

44
enum SingleVariantEnum {

tests/ui/result_map_unit_fn.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(never_type)]
12
#![warn(result_map_unit_fn)]
23
#![allow(unused)]
34

tests/ui/result_map_unit_fn.stderr

+49-49
Original file line numberDiff line numberDiff line change
@@ -1,191 +1,191 @@
11
error: called `map(f)` on an Result value where `f` is a unit function
2-
--> $DIR/result_map_unit_fn.rs:32:5
2+
--> $DIR/result_map_unit_fn.rs:33:5
33
|
4-
32 | x.field.map(do_nothing);
4+
33 | x.field.map(do_nothing);
55
| ^^^^^^^^^^^^^^^^^^^^^^^-
66
| |
77
| help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }`
88
|
99
= note: `-D result-map-unit-fn` implied by `-D warnings`
1010

1111
error: called `map(f)` on an Result value where `f` is a unit function
12-
--> $DIR/result_map_unit_fn.rs:34:5
12+
--> $DIR/result_map_unit_fn.rs:35:5
1313
|
14-
34 | x.field.map(do_nothing);
14+
35 | x.field.map(do_nothing);
1515
| ^^^^^^^^^^^^^^^^^^^^^^^-
1616
| |
1717
| help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }`
1818

1919
error: called `map(f)` on an Result value where `f` is a unit function
20-
--> $DIR/result_map_unit_fn.rs:36:5
20+
--> $DIR/result_map_unit_fn.rs:37:5
2121
|
22-
36 | x.field.map(diverge);
22+
37 | x.field.map(diverge);
2323
| ^^^^^^^^^^^^^^^^^^^^-
2424
| |
2525
| help: try this: `if let Ok(x_field) = x.field { diverge(...) }`
2626

2727
error: called `map(f)` on an Result value where `f` is a unit closure
28-
--> $DIR/result_map_unit_fn.rs:42:5
28+
--> $DIR/result_map_unit_fn.rs:43:5
2929
|
30-
42 | x.field.map(|value| x.do_result_nothing(value + captured));
30+
43 | x.field.map(|value| x.do_result_nothing(value + captured));
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
3232
| |
3333
| help: try this: `if let Ok(value) = x.field { x.do_result_nothing(value + captured) }`
3434

3535
error: called `map(f)` on an Result value where `f` is a unit closure
36-
--> $DIR/result_map_unit_fn.rs:44:5
36+
--> $DIR/result_map_unit_fn.rs:45:5
3737
|
38-
44 | x.field.map(|value| { x.do_result_plus_one(value + captured); });
38+
45 | x.field.map(|value| { x.do_result_plus_one(value + captured); });
3939
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
4040
| |
4141
| help: try this: `if let Ok(value) = x.field { x.do_result_plus_one(value + captured); }`
4242

4343
error: called `map(f)` on an Result value where `f` is a unit closure
44-
--> $DIR/result_map_unit_fn.rs:47:5
44+
--> $DIR/result_map_unit_fn.rs:48:5
4545
|
46-
47 | x.field.map(|value| do_nothing(value + captured));
46+
48 | x.field.map(|value| do_nothing(value + captured));
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
4848
| |
4949
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }`
5050

5151
error: called `map(f)` on an Result value where `f` is a unit closure
52-
--> $DIR/result_map_unit_fn.rs:49:5
52+
--> $DIR/result_map_unit_fn.rs:50:5
5353
|
54-
49 | x.field.map(|value| { do_nothing(value + captured) });
54+
50 | x.field.map(|value| { do_nothing(value + captured) });
5555
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
5656
| |
5757
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }`
5858

5959
error: called `map(f)` on an Result value where `f` is a unit closure
60-
--> $DIR/result_map_unit_fn.rs:51:5
60+
--> $DIR/result_map_unit_fn.rs:52:5
6161
|
62-
51 | x.field.map(|value| { do_nothing(value + captured); });
62+
52 | x.field.map(|value| { do_nothing(value + captured); });
6363
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
6464
| |
6565
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }`
6666

6767
error: called `map(f)` on an Result value where `f` is a unit closure
68-
--> $DIR/result_map_unit_fn.rs:53:5
68+
--> $DIR/result_map_unit_fn.rs:54:5
6969
|
70-
53 | x.field.map(|value| { { do_nothing(value + captured); } });
70+
54 | x.field.map(|value| { { do_nothing(value + captured); } });
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
7272
| |
7373
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }`
7474

7575
error: called `map(f)` on an Result value where `f` is a unit closure
76-
--> $DIR/result_map_unit_fn.rs:56:5
76+
--> $DIR/result_map_unit_fn.rs:57:5
7777
|
78-
56 | x.field.map(|value| diverge(value + captured));
78+
57 | x.field.map(|value| diverge(value + captured));
7979
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
8080
| |
8181
| help: try this: `if let Ok(value) = x.field { diverge(value + captured) }`
8282

8383
error: called `map(f)` on an Result value where `f` is a unit closure
84-
--> $DIR/result_map_unit_fn.rs:58:5
84+
--> $DIR/result_map_unit_fn.rs:59:5
8585
|
86-
58 | x.field.map(|value| { diverge(value + captured) });
86+
59 | x.field.map(|value| { diverge(value + captured) });
8787
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
8888
| |
8989
| help: try this: `if let Ok(value) = x.field { diverge(value + captured) }`
9090

9191
error: called `map(f)` on an Result value where `f` is a unit closure
92-
--> $DIR/result_map_unit_fn.rs:60:5
92+
--> $DIR/result_map_unit_fn.rs:61:5
9393
|
94-
60 | x.field.map(|value| { diverge(value + captured); });
94+
61 | x.field.map(|value| { diverge(value + captured); });
9595
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
9696
| |
9797
| help: try this: `if let Ok(value) = x.field { diverge(value + captured); }`
9898

9999
error: called `map(f)` on an Result value where `f` is a unit closure
100-
--> $DIR/result_map_unit_fn.rs:62:5
100+
--> $DIR/result_map_unit_fn.rs:63:5
101101
|
102-
62 | x.field.map(|value| { { diverge(value + captured); } });
102+
63 | x.field.map(|value| { { diverge(value + captured); } });
103103
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
104104
| |
105105
| help: try this: `if let Ok(value) = x.field { diverge(value + captured); }`
106106

107107
error: called `map(f)` on an Result value where `f` is a unit closure
108-
--> $DIR/result_map_unit_fn.rs:67:5
108+
--> $DIR/result_map_unit_fn.rs:68:5
109109
|
110-
67 | x.field.map(|value| { let y = plus_one(value + captured); });
110+
68 | x.field.map(|value| { let y = plus_one(value + captured); });
111111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
112112
| |
113113
| help: try this: `if let Ok(value) = x.field { let y = plus_one(value + captured); }`
114114

115115
error: called `map(f)` on an Result value where `f` is a unit closure
116-
--> $DIR/result_map_unit_fn.rs:69:5
116+
--> $DIR/result_map_unit_fn.rs:70:5
117117
|
118-
69 | x.field.map(|value| { plus_one(value + captured); });
118+
70 | x.field.map(|value| { plus_one(value + captured); });
119119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
120120
| |
121121
| help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }`
122122

123123
error: called `map(f)` on an Result value where `f` is a unit closure
124-
--> $DIR/result_map_unit_fn.rs:71:5
124+
--> $DIR/result_map_unit_fn.rs:72:5
125125
|
126-
71 | x.field.map(|value| { { plus_one(value + captured); } });
126+
72 | x.field.map(|value| { { plus_one(value + captured); } });
127127
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
128128
| |
129129
| help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }`
130130

131131
error: called `map(f)` on an Result value where `f` is a unit closure
132-
--> $DIR/result_map_unit_fn.rs:74:5
132+
--> $DIR/result_map_unit_fn.rs:75:5
133133
|
134-
74 | x.field.map(|ref value| { do_nothing(value + captured) });
134+
75 | x.field.map(|ref value| { do_nothing(value + captured) });
135135
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
136136
| |
137137
| help: try this: `if let Ok(ref value) = x.field { do_nothing(value + captured) }`
138138

139139
error: called `map(f)` on an Result value where `f` is a unit closure
140-
--> $DIR/result_map_unit_fn.rs:77:5
140+
--> $DIR/result_map_unit_fn.rs:78:5
141141
|
142-
77 | x.field.map(|value| { do_nothing(value); do_nothing(value) });
142+
78 | x.field.map(|value| { do_nothing(value); do_nothing(value) });
143143
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
144144
| |
145145
| help: try this: `if let Ok(value) = x.field { ... }`
146146

147147
error: called `map(f)` on an Result value where `f` is a unit closure
148-
--> $DIR/result_map_unit_fn.rs:79:5
148+
--> $DIR/result_map_unit_fn.rs:80:5
149149
|
150-
79 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
150+
80 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
151151
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
152152
| |
153153
| help: try this: `if let Ok(value) = x.field { ... }`
154154

155155
error: called `map(f)` on an Result value where `f` is a unit closure
156-
--> $DIR/result_map_unit_fn.rs:83:5
156+
--> $DIR/result_map_unit_fn.rs:84:5
157157
|
158-
83 | x.field.map(|value| {
158+
84 | x.field.map(|value| {
159159
| _____^
160160
| |_____|
161161
| ||
162-
84 | || do_nothing(value);
163-
85 | || do_nothing(value)
164-
86 | || });
162+
85 | || do_nothing(value);
163+
86 | || do_nothing(value)
164+
87 | || });
165165
| ||______^- help: try this: `if let Ok(value) = x.field { ... }`
166166
| |_______|
167167
|
168168

169169
error: called `map(f)` on an Result value where `f` is a unit closure
170-
--> $DIR/result_map_unit_fn.rs:87:5
170+
--> $DIR/result_map_unit_fn.rs:88:5
171171
|
172-
87 | x.field.map(|value| { do_nothing(value); do_nothing(value); });
172+
88 | x.field.map(|value| { do_nothing(value); do_nothing(value); });
173173
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
174174
| |
175175
| help: try this: `if let Ok(value) = x.field { ... }`
176176

177177
error: called `map(f)` on an Result value where `f` is a unit function
178-
--> $DIR/result_map_unit_fn.rs:91:5
178+
--> $DIR/result_map_unit_fn.rs:92:5
179179
|
180-
91 | "12".parse::<i32>().map(diverge);
180+
92 | "12".parse::<i32>().map(diverge);
181181
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
182182
| |
183183
| help: try this: `if let Ok(_) = "12".parse::<i32>() { diverge(...) }`
184184

185185
error: called `map(f)` on an Result value where `f` is a unit function
186-
--> $DIR/result_map_unit_fn.rs:97:5
186+
--> $DIR/result_map_unit_fn.rs:98:5
187187
|
188-
97 | y.map(do_nothing);
188+
98 | y.map(do_nothing);
189189
| ^^^^^^^^^^^^^^^^^-
190190
| |
191191
| help: try this: `if let Ok(_y) = y { do_nothing(...) }`

0 commit comments

Comments
 (0)