mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
rustup
This commit is contained in:
parent
3b6440212d
commit
cc7d66aa9c
10 changed files with 61 additions and 55 deletions
|
@ -615,6 +615,7 @@ All notable changes to this project will be documented in this file.
|
||||||
[`eq_op`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#eq_op
|
[`eq_op`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#eq_op
|
||||||
[`erasing_op`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#erasing_op
|
[`erasing_op`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#erasing_op
|
||||||
[`eval_order_dependence`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#eval_order_dependence
|
[`eval_order_dependence`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#eval_order_dependence
|
||||||
|
[`excessive_precision`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#excessive_precision
|
||||||
[`expl_impl_clone_on_copy`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#expl_impl_clone_on_copy
|
[`expl_impl_clone_on_copy`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#expl_impl_clone_on_copy
|
||||||
[`explicit_counter_loop`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#explicit_counter_loop
|
[`explicit_counter_loop`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#explicit_counter_loop
|
||||||
[`explicit_into_iter_loop`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#explicit_into_iter_loop
|
[`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.
|
||||||
[`inconsistent_digit_grouping`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping
|
[`inconsistent_digit_grouping`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping
|
||||||
[`indexing_slicing`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#indexing_slicing
|
[`indexing_slicing`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#indexing_slicing
|
||||||
[`ineffective_bit_mask`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#ineffective_bit_mask
|
[`ineffective_bit_mask`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#ineffective_bit_mask
|
||||||
|
[`infallible_destructuring_match`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#infallible_destructuring_match
|
||||||
[`infinite_iter`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#infinite_iter
|
[`infinite_iter`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#infinite_iter
|
||||||
[`inline_always`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#inline_always
|
[`inline_always`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#inline_always
|
||||||
[`inline_fn_without_body`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#inline_fn_without_body
|
[`inline_fn_without_body`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#inline_fn_without_body
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
|
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
|
||||||
|
|
||||||
[There are 255 lints included in this crate!](https://rust-lang-nursery.github.io/rust-clippy/master/index.html)
|
[There are 257 lints included in this crate!](https://rust-lang-nursery.github.io/rust-clippy/master/index.html)
|
||||||
|
|
||||||
We have a bunch of lint categories to allow you to choose how much clippy is supposed to ~~annoy~~ help you:
|
We have a bunch of lint categories to allow you to choose how much clippy is supposed to ~~annoy~~ help you:
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ use rustc::ty;
|
||||||
use rustc::hir::def::Def;
|
use rustc::hir::def::Def;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::abi::Abi;
|
use rustc_target::spec::abi::Abi;
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
use utils::{iter_input_pats, span_lint, type_is_unsafe_function};
|
use utils::{iter_input_pats, span_lint, type_is_unsafe_function};
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rustc;
|
extern crate rustc;
|
||||||
extern crate rustc_typeck;
|
extern crate rustc_typeck;
|
||||||
|
extern crate rustc_target;
|
||||||
extern crate syntax;
|
extern crate syntax;
|
||||||
extern crate syntax_pos;
|
extern crate syntax_pos;
|
||||||
|
|
||||||
|
@ -516,6 +517,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||||
eta_reduction::REDUNDANT_CLOSURE,
|
eta_reduction::REDUNDANT_CLOSURE,
|
||||||
eval_order_dependence::DIVERGING_SUB_EXPRESSION,
|
eval_order_dependence::DIVERGING_SUB_EXPRESSION,
|
||||||
eval_order_dependence::EVAL_ORDER_DEPENDENCE,
|
eval_order_dependence::EVAL_ORDER_DEPENDENCE,
|
||||||
|
excessive_precision::EXCESSIVE_PRECISION,
|
||||||
explicit_write::EXPLICIT_WRITE,
|
explicit_write::EXPLICIT_WRITE,
|
||||||
format::USELESS_FORMAT,
|
format::USELESS_FORMAT,
|
||||||
formatting::POSSIBLE_MISSING_COMMA,
|
formatting::POSSIBLE_MISSING_COMMA,
|
||||||
|
@ -692,6 +694,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||||
enum_variants::MODULE_INCEPTION,
|
enum_variants::MODULE_INCEPTION,
|
||||||
eq_op::OP_REF,
|
eq_op::OP_REF,
|
||||||
eta_reduction::REDUNDANT_CLOSURE,
|
eta_reduction::REDUNDANT_CLOSURE,
|
||||||
|
excessive_precision::EXCESSIVE_PRECISION,
|
||||||
formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
|
formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
|
||||||
formatting::SUSPICIOUS_ELSE_FORMATTING,
|
formatting::SUSPICIOUS_ELSE_FORMATTING,
|
||||||
if_let_redundant_pattern_matching::IF_LET_REDUNDANT_PATTERN_MATCHING,
|
if_let_redundant_pattern_matching::IF_LET_REDUNDANT_PATTERN_MATCHING,
|
||||||
|
|
|
@ -6,7 +6,7 @@ use rustc::ty::{self, RegionKind, TypeFoldable};
|
||||||
use rustc::traits;
|
use rustc::traits;
|
||||||
use rustc::middle::expr_use_visitor as euv;
|
use rustc::middle::expr_use_visitor as euv;
|
||||||
use rustc::middle::mem_categorization as mc;
|
use rustc::middle::mem_categorization as mc;
|
||||||
use syntax::abi::Abi;
|
use rustc_target::spec::abi::Abi;
|
||||||
use syntax::ast::NodeId;
|
use syntax::ast::NodeId;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
use syntax::errors::DiagnosticBuilder;
|
use syntax::errors::DiagnosticBuilder;
|
||||||
|
|
|
@ -8,7 +8,7 @@ use rustc::hir::map::Node;
|
||||||
use rustc::lint::{LateContext, Level, Lint, LintContext};
|
use rustc::lint::{LateContext, Level, Lint, LintContext};
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::traits;
|
use rustc::traits;
|
||||||
use rustc::ty::{self, Ty, TyCtxt, layout};
|
use rustc::ty::{self, Ty, TyCtxt, layout::{self, IntegerExt}};
|
||||||
use rustc_errors;
|
use rustc_errors;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![feature(proc_macro)]
|
#![feature(proc_macro, proc_macro_non_items)]
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
use proc_macro::{TokenStream, quote};
|
use proc_macro::{TokenStream, quote};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![feature(exhaustive_patterns)]
|
#![feature(exhaustive_patterns, never_type)]
|
||||||
#![allow(let_and_return)]
|
#![allow(let_and_return)]
|
||||||
|
|
||||||
enum SingleVariantEnum {
|
enum SingleVariantEnum {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![feature(never_type)]
|
||||||
#![warn(result_map_unit_fn)]
|
#![warn(result_map_unit_fn)]
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
error: called `map(f)` on an Result value where `f` is a unit function
|
error: called `map(f)` on an Result value where `f` is a unit function
|
||||||
--> $DIR/result_map_unit_fn.rs:32:5
|
--> $DIR/result_map_unit_fn.rs:33:5
|
||||||
|
|
|
|
||||||
32 | x.field.map(do_nothing);
|
33 | x.field.map(do_nothing);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }`
|
| help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }`
|
||||||
|
@ -9,183 +9,183 @@ error: called `map(f)` on an Result value where `f` is a unit function
|
||||||
= note: `-D result-map-unit-fn` implied by `-D warnings`
|
= note: `-D result-map-unit-fn` implied by `-D warnings`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit function
|
error: called `map(f)` on an Result value where `f` is a unit function
|
||||||
--> $DIR/result_map_unit_fn.rs:34:5
|
--> $DIR/result_map_unit_fn.rs:35:5
|
||||||
|
|
|
|
||||||
34 | x.field.map(do_nothing);
|
35 | x.field.map(do_nothing);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }`
|
| help: try this: `if let Ok(x_field) = x.field { do_nothing(...) }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit function
|
error: called `map(f)` on an Result value where `f` is a unit function
|
||||||
--> $DIR/result_map_unit_fn.rs:36:5
|
--> $DIR/result_map_unit_fn.rs:37:5
|
||||||
|
|
|
|
||||||
36 | x.field.map(diverge);
|
37 | x.field.map(diverge);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(x_field) = x.field { diverge(...) }`
|
| help: try this: `if let Ok(x_field) = x.field { diverge(...) }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:42:5
|
--> $DIR/result_map_unit_fn.rs:43:5
|
||||||
|
|
|
|
||||||
42 | x.field.map(|value| x.do_result_nothing(value + captured));
|
43 | x.field.map(|value| x.do_result_nothing(value + captured));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { x.do_result_nothing(value + captured) }`
|
| help: try this: `if let Ok(value) = x.field { x.do_result_nothing(value + captured) }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:44:5
|
--> $DIR/result_map_unit_fn.rs:45:5
|
||||||
|
|
|
|
||||||
44 | x.field.map(|value| { x.do_result_plus_one(value + captured); });
|
45 | x.field.map(|value| { x.do_result_plus_one(value + captured); });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { x.do_result_plus_one(value + captured); }`
|
| help: try this: `if let Ok(value) = x.field { x.do_result_plus_one(value + captured); }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:47:5
|
--> $DIR/result_map_unit_fn.rs:48:5
|
||||||
|
|
|
|
||||||
47 | x.field.map(|value| do_nothing(value + captured));
|
48 | x.field.map(|value| do_nothing(value + captured));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }`
|
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:49:5
|
--> $DIR/result_map_unit_fn.rs:50:5
|
||||||
|
|
|
|
||||||
49 | x.field.map(|value| { do_nothing(value + captured) });
|
50 | x.field.map(|value| { do_nothing(value + captured) });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }`
|
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured) }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:51:5
|
--> $DIR/result_map_unit_fn.rs:52:5
|
||||||
|
|
|
|
||||||
51 | x.field.map(|value| { do_nothing(value + captured); });
|
52 | x.field.map(|value| { do_nothing(value + captured); });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }`
|
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:53:5
|
--> $DIR/result_map_unit_fn.rs:54:5
|
||||||
|
|
|
|
||||||
53 | x.field.map(|value| { { do_nothing(value + captured); } });
|
54 | x.field.map(|value| { { do_nothing(value + captured); } });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }`
|
| help: try this: `if let Ok(value) = x.field { do_nothing(value + captured); }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:56:5
|
--> $DIR/result_map_unit_fn.rs:57:5
|
||||||
|
|
|
|
||||||
56 | x.field.map(|value| diverge(value + captured));
|
57 | x.field.map(|value| diverge(value + captured));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { diverge(value + captured) }`
|
| help: try this: `if let Ok(value) = x.field { diverge(value + captured) }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:58:5
|
--> $DIR/result_map_unit_fn.rs:59:5
|
||||||
|
|
|
|
||||||
58 | x.field.map(|value| { diverge(value + captured) });
|
59 | x.field.map(|value| { diverge(value + captured) });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { diverge(value + captured) }`
|
| help: try this: `if let Ok(value) = x.field { diverge(value + captured) }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:60:5
|
--> $DIR/result_map_unit_fn.rs:61:5
|
||||||
|
|
|
|
||||||
60 | x.field.map(|value| { diverge(value + captured); });
|
61 | x.field.map(|value| { diverge(value + captured); });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { diverge(value + captured); }`
|
| help: try this: `if let Ok(value) = x.field { diverge(value + captured); }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:62:5
|
--> $DIR/result_map_unit_fn.rs:63:5
|
||||||
|
|
|
|
||||||
62 | x.field.map(|value| { { diverge(value + captured); } });
|
63 | x.field.map(|value| { { diverge(value + captured); } });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { diverge(value + captured); }`
|
| help: try this: `if let Ok(value) = x.field { diverge(value + captured); }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:67:5
|
--> $DIR/result_map_unit_fn.rs:68:5
|
||||||
|
|
|
|
||||||
67 | x.field.map(|value| { let y = plus_one(value + captured); });
|
68 | x.field.map(|value| { let y = plus_one(value + captured); });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { let y = plus_one(value + captured); }`
|
| help: try this: `if let Ok(value) = x.field { let y = plus_one(value + captured); }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:69:5
|
--> $DIR/result_map_unit_fn.rs:70:5
|
||||||
|
|
|
|
||||||
69 | x.field.map(|value| { plus_one(value + captured); });
|
70 | x.field.map(|value| { plus_one(value + captured); });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }`
|
| help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:71:5
|
--> $DIR/result_map_unit_fn.rs:72:5
|
||||||
|
|
|
|
||||||
71 | x.field.map(|value| { { plus_one(value + captured); } });
|
72 | x.field.map(|value| { { plus_one(value + captured); } });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }`
|
| help: try this: `if let Ok(value) = x.field { plus_one(value + captured); }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:74:5
|
--> $DIR/result_map_unit_fn.rs:75:5
|
||||||
|
|
|
|
||||||
74 | x.field.map(|ref value| { do_nothing(value + captured) });
|
75 | x.field.map(|ref value| { do_nothing(value + captured) });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(ref value) = x.field { do_nothing(value + captured) }`
|
| help: try this: `if let Ok(ref value) = x.field { do_nothing(value + captured) }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:77:5
|
--> $DIR/result_map_unit_fn.rs:78:5
|
||||||
|
|
|
|
||||||
77 | x.field.map(|value| { do_nothing(value); do_nothing(value) });
|
78 | x.field.map(|value| { do_nothing(value); do_nothing(value) });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { ... }`
|
| help: try this: `if let Ok(value) = x.field { ... }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:79:5
|
--> $DIR/result_map_unit_fn.rs:80:5
|
||||||
|
|
|
|
||||||
79 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
|
80 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { ... }`
|
| help: try this: `if let Ok(value) = x.field { ... }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:83:5
|
--> $DIR/result_map_unit_fn.rs:84:5
|
||||||
|
|
|
|
||||||
83 | x.field.map(|value| {
|
84 | x.field.map(|value| {
|
||||||
| _____^
|
| _____^
|
||||||
| |_____|
|
| |_____|
|
||||||
| ||
|
| ||
|
||||||
84 | || do_nothing(value);
|
85 | || do_nothing(value);
|
||||||
85 | || do_nothing(value)
|
86 | || do_nothing(value)
|
||||||
86 | || });
|
87 | || });
|
||||||
| ||______^- help: try this: `if let Ok(value) = x.field { ... }`
|
| ||______^- help: try this: `if let Ok(value) = x.field { ... }`
|
||||||
| |_______|
|
| |_______|
|
||||||
|
|
|
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit closure
|
error: called `map(f)` on an Result value where `f` is a unit closure
|
||||||
--> $DIR/result_map_unit_fn.rs:87:5
|
--> $DIR/result_map_unit_fn.rs:88:5
|
||||||
|
|
|
|
||||||
87 | x.field.map(|value| { do_nothing(value); do_nothing(value); });
|
88 | x.field.map(|value| { do_nothing(value); do_nothing(value); });
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(value) = x.field { ... }`
|
| help: try this: `if let Ok(value) = x.field { ... }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit function
|
error: called `map(f)` on an Result value where `f` is a unit function
|
||||||
--> $DIR/result_map_unit_fn.rs:91:5
|
--> $DIR/result_map_unit_fn.rs:92:5
|
||||||
|
|
|
|
||||||
91 | "12".parse::<i32>().map(diverge);
|
92 | "12".parse::<i32>().map(diverge);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(_) = "12".parse::<i32>() { diverge(...) }`
|
| help: try this: `if let Ok(_) = "12".parse::<i32>() { diverge(...) }`
|
||||||
|
|
||||||
error: called `map(f)` on an Result value where `f` is a unit function
|
error: called `map(f)` on an Result value where `f` is a unit function
|
||||||
--> $DIR/result_map_unit_fn.rs:97:5
|
--> $DIR/result_map_unit_fn.rs:98:5
|
||||||
|
|
|
|
||||||
97 | y.map(do_nothing);
|
98 | y.map(do_nothing);
|
||||||
| ^^^^^^^^^^^^^^^^^-
|
| ^^^^^^^^^^^^^^^^^-
|
||||||
| |
|
| |
|
||||||
| help: try this: `if let Ok(_y) = y { do_nothing(...) }`
|
| help: try this: `if let Ok(_y) = y { do_nothing(...) }`
|
||||||
|
|
Loading…
Reference in a new issue