Merge pull request #2817 from mati865/rustup

Update to nightly 2018-05-28
This commit is contained in:
Oliver Schneider 2018-05-29 11:51:55 +02:00 committed by GitHub
commit 946b846fe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 141 additions and 144 deletions

View file

@ -147,9 +147,9 @@ fn check_unformatted(expr: &Expr) -> bool {
if let ExprArray(ref exprs) = expr.node;
if exprs.len() == 1;
if let ExprStruct(_, ref fields, _) = exprs[0].node;
if let Some(format_field) = fields.iter().find(|f| f.name.node == "format");
if let Some(format_field) = fields.iter().find(|f| f.ident.name == "format");
if let ExprStruct(_, ref fields, _) = format_field.expr.node;
if let Some(align_field) = fields.iter().find(|f| f.name.node == "width");
if let Some(align_field) = fields.iter().find(|f| f.ident.name == "width");
if let ExprPath(ref qpath) = align_field.expr.node;
if last_path_segment(qpath).name == "Implied";
then {

View file

@ -10,13 +10,13 @@
#![recursion_limit = "256"]
#![allow(stable_features)]
#![feature(iterator_find_map)]
#![feature(macro_at_most_once_rep)]
extern crate cargo_metadata;
#[macro_use]
extern crate rustc;
extern crate rustc_typeck;
extern crate rustc_target;
extern crate rustc_typeck;
extern crate syntax;
extern crate syntax_pos;

View file

@ -392,8 +392,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
None
}
},
ExprField(_, spanned) => {
let name = spanned.node.as_str();
ExprField(_, ident) => {
let name = ident.as_str();
if name.starts_with('_') && !name.starts_with("__") {
Some(name)
} else {

View file

@ -45,7 +45,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantFieldNames {
if let ExprStruct(_, ref fields, _) = expr.node {
for field in fields {
let name = field.name.node;
let name = field.ident.name;
if match_var(&field.expr, name) && !field.is_shorthand {
span_lint_and_sugg (

View file

@ -187,10 +187,10 @@ fn check_pat<'a, 'tcx>(
PatKind::Struct(_, ref pfields, _) => if let Some(init_struct) = init {
if let ExprStruct(_, ref efields, _) = init_struct.node {
for field in pfields {
let name = field.node.name;
let name = field.node.ident.name;
let efield = efields
.iter()
.find(|f| f.name.node == name)
.find(|f| f.ident.name == name)
.map(|f| &*f.expr);
check_pat(cx, &field.node.pat, efield, span, bindings);
}

View file

@ -383,11 +383,11 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
self.current = value_pat;
self.visit_expr(value);
},
Expr_::ExprField(ref object, ref field_name) => {
Expr_::ExprField(ref object, ref field_ident) => {
let obj_pat = self.next("object");
let field_name_pat = self.next("field_name");
println!("Field(ref {}, ref {}) = {};", obj_pat, field_name_pat, current);
println!(" if {}.node.as_str() == {:?}", field_name_pat, field_name.node.as_str());
println!(" if {}.node.as_str() == {:?}", field_name_pat, field_ident.name.as_str());
self.current = obj_pat;
self.visit_expr(object);
},

View file

@ -77,7 +77,7 @@ pub fn range<'a, 'b, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'b hir::Expr) -> O
/// Find the field named `name` in the field. Always return `Some` for
/// convenience.
fn get_field<'a>(name: &str, fields: &'a [hir::Field]) -> Option<&'a hir::Expr> {
let expr = &fields.iter().find(|field| field.name.node == name)?.expr;
let expr = &fields.iter().find(|field| field.ident.name == name)?.expr;
Some(expr)
}

View file

@ -101,7 +101,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
(&ExprCast(ref lx, ref lt), &ExprCast(ref rx, ref rt)) |
(&ExprType(ref lx, ref lt), &ExprType(ref rx, ref rt)) => self.eq_expr(lx, rx) && self.eq_ty(lt, rt),
(&ExprField(ref l_f_exp, ref l_f_ident), &ExprField(ref r_f_exp, ref r_f_ident)) => {
l_f_ident.node == r_f_ident.node && self.eq_expr(l_f_exp, r_f_exp)
l_f_ident.name == r_f_ident.name && self.eq_expr(l_f_exp, r_f_exp)
},
(&ExprIndex(ref la, ref li), &ExprIndex(ref ra, ref ri)) => self.eq_expr(la, ra) && self.eq_expr(li, ri),
(&ExprIf(ref lc, ref lt, ref le), &ExprIf(ref rc, ref rt, ref re)) => {
@ -149,7 +149,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
}
fn eq_field(&mut self, left: &Field, right: &Field) -> bool {
left.name.node == right.name.node && self.eq_expr(&left.expr, &right.expr)
left.ident.name == right.ident.name && self.eq_expr(&left.expr, &right.expr)
}
fn eq_lifetime(&mut self, left: &Lifetime, right: &Lifetime) -> bool {
@ -419,7 +419,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
let c: fn(_, _) -> _ = ExprField;
c.hash(&mut self.s);
self.hash_expr(e);
self.hash_name(&f.node);
self.hash_name(&f.name);
},
ExprIndex(ref a, ref i) => {
let c: fn(_, _) -> _ = ExprIndex;
@ -502,7 +502,7 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
self.hash_qpath(path);
for f in fields {
self.hash_name(&f.name.node);
self.hash_name(&f.ident.name);
self.hash_expr(&f.expr);
}

View file

@ -268,9 +268,9 @@ fn print_expr(cx: &LateContext, expr: &hir::Expr, indent: usize) {
println!("{}rhs:", ind);
print_expr(cx, rhs, indent + 1);
},
hir::ExprField(ref e, ref name) => {
hir::ExprField(ref e, ref ident) => {
println!("{}Field", ind);
println!("{}field name: {}", ind, name.node);
println!("{}field name: {}", ind, ident.name);
println!("{}struct expr:", ind);
print_expr(cx, e, indent + 1);
},
@ -322,7 +322,7 @@ fn print_expr(cx: &LateContext, expr: &hir::Expr, indent: usize) {
println!("{}Struct", ind);
println!("{}path: {:?}", ind, path);
for field in fields {
println!("{}field \"{}\":", ind, field.name.node);
println!("{}field \"{}\":", ind, field.ident.name);
print_expr(cx, &field.expr, indent + 1);
}
if let Some(ref base) = *base {
@ -433,7 +433,7 @@ fn print_pat(cx: &LateContext, pat: &hir::Pat, indent: usize) {
println!("{}ignore leftover fields: {}", ind, ignore);
println!("{}fields:", ind);
for field in fields {
println!("{} field name: {}", ind, field.node.name);
println!("{} field name: {}", ind, field.node.ident.name);
if field.node.is_shorthand {
println!("{} in shorthand notation", ind);
}

View file

@ -97,6 +97,7 @@ impl<'a> Sugg<'a> {
ast::ExprKind::Closure(..) |
ast::ExprKind::If(..) |
ast::ExprKind::IfLet(..) |
ast::ExprKind::ObsoleteInPlace(..) |
ast::ExprKind::Unary(..) |
ast::ExprKind::Match(..) => Sugg::MaybeParen(snippet),
ast::ExprKind::Block(..) |
@ -320,6 +321,7 @@ pub fn make_assoc(op: AssocOp, lhs: &Sugg, rhs: &Sugg) -> Sugg<'static> {
AssocOp::ShiftRight |
AssocOp::Subtract => format!("{} {} {}", lhs, op.to_ast_binop().expect("Those are AST ops").to_string(), rhs),
AssocOp::Assign => format!("{} = {}", lhs, rhs),
AssocOp::ObsoleteInPlace => format!("in ({}) {}", lhs, rhs),
AssocOp::AssignOp(op) => format!("{} {}= {}", lhs, token_to_string(&token::BinOp(op)), rhs),
AssocOp::As => format!("{} as {}", lhs, rhs),
AssocOp::DotDot => format!("{}..{}", lhs, rhs),
@ -360,7 +362,7 @@ fn associativity(op: &AssocOp) -> Associativity {
use syntax::util::parser::AssocOp::*;
match *op {
Assign | AssignOp(_) => Associativity::Right,
ObsoleteInPlace | Assign | AssignOp(_) => Associativity::Right,
Add | BitAnd | BitOr | BitXor | LAnd | LOr | Multiply | As | Colon => Associativity::Both,
Divide |
Equal |

View file

@ -375,7 +375,7 @@ where
if let ExprArray(ref format_exprs) = format_expr.node;
if format_exprs.len() >= 1;
if let ExprStruct(_, ref fields, _) = format_exprs[idx].node;
if let Some(format_field) = fields.iter().find(|f| f.name.node == "format");
if let Some(format_field) = fields.iter().find(|f| f.ident.name == "format");
if check_unformatted(&format_field.expr);
then {
lint_fn(tup_val.span);
@ -469,13 +469,13 @@ fn is_in_debug_impl(cx: &LateContext, expr: &Expr) -> bool {
pub fn check_unformatted(format_field: &Expr) -> bool {
if_chain! {
if let ExprStruct(_, ref fields, _) = format_field.node;
if let Some(width_field) = fields.iter().find(|f| f.name.node == "width");
if let Some(width_field) = fields.iter().find(|f| f.ident.name == "width");
if let ExprPath(ref qpath) = width_field.expr.node;
if last_path_segment(qpath).name == "Implied";
if let Some(align_field) = fields.iter().find(|f| f.name.node == "align");
if let Some(align_field) = fields.iter().find(|f| f.ident.name == "align");
if let ExprPath(ref qpath) = align_field.expr.node;
if last_path_segment(qpath).name == "Unknown";
if let Some(precision_field) = fields.iter().find(|f| f.name.node == "precision");
if let Some(precision_field) = fields.iter().find(|f| f.ident.name == "precision");
if let ExprPath(ref qpath_precision) = precision_field.expr.node;
if last_path_segment(qpath_precision).name == "Implied";
then {

View file

@ -78,7 +78,7 @@ error: the loop variable `i` is only used to index `vec`.
help: consider using an iterator
|
86 | for <item> in &vec {
|
| ^^^^^^ ^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:95:14
@ -88,7 +88,7 @@ error: the loop variable `i` is only used to index `vec`.
help: consider using an iterator
|
95 | for <item> in &vec {
|
| ^^^^^^ ^^^^
error: the loop variable `j` is only used to index `STATIC`.
--> $DIR/for_loop.rs:100:14
@ -98,7 +98,7 @@ error: the loop variable `j` is only used to index `STATIC`.
help: consider using an iterator
|
100 | for <item> in STATIC.iter().take(4) {
|
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `j` is only used to index `CONST`.
--> $DIR/for_loop.rs:104:14
@ -108,7 +108,7 @@ error: the loop variable `j` is only used to index `CONST`.
help: consider using an iterator
|
104 | for <item> in CONST.iter().take(4) {
|
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is used to index `vec`
--> $DIR/for_loop.rs:108:14
@ -118,7 +118,7 @@ error: the loop variable `i` is used to index `vec`
help: consider using an iterator
|
108 | for (i, <item>) in vec.iter().enumerate() {
|
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec2`.
--> $DIR/for_loop.rs:116:14
@ -128,7 +128,7 @@ error: the loop variable `i` is only used to index `vec2`.
help: consider using an iterator
|
116 | for <item> in vec2.iter().take(vec.len()) {
|
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:120:14
@ -138,7 +138,7 @@ error: the loop variable `i` is only used to index `vec`.
help: consider using an iterator
|
120 | for <item> in vec.iter().skip(5) {
|
| ^^^^^^ ^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:124:14
@ -148,7 +148,7 @@ error: the loop variable `i` is only used to index `vec`.
help: consider using an iterator
|
124 | for <item> in vec.iter().take(MAX_LEN) {
|
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:128:14
@ -158,7 +158,7 @@ error: the loop variable `i` is only used to index `vec`.
help: consider using an iterator
|
128 | for <item> in vec.iter().take(MAX_LEN + 1) {
|
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:132:14
@ -168,7 +168,7 @@ error: the loop variable `i` is only used to index `vec`.
help: consider using an iterator
|
132 | for <item> in vec.iter().take(10).skip(5) {
|
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:136:14
@ -178,7 +178,7 @@ error: the loop variable `i` is only used to index `vec`.
help: consider using an iterator
|
136 | for <item> in vec.iter().take(10 + 1).skip(5) {
|
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is used to index `vec`
--> $DIR/for_loop.rs:140:14
@ -188,7 +188,7 @@ error: the loop variable `i` is used to index `vec`
help: consider using an iterator
|
140 | for (i, <item>) in vec.iter().enumerate().skip(5) {
|
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is used to index `vec`
--> $DIR/for_loop.rs:144:14
@ -198,7 +198,7 @@ error: the loop variable `i` is used to index `vec`
help: consider using an iterator
|
144 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
|
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:148:14
@ -384,7 +384,7 @@ error: you seem to want to iterate on a map's values
help: use the corresponding method
|
385 | for v in m.values() {
|
| ^ ^^^^^^^^^^
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:390:19
@ -394,7 +394,7 @@ error: you seem to want to iterate on a map's values
help: use the corresponding method
|
390 | for v in (*m).values() {
|
| ^ ^^^^^^^^^^^^^
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:398:19
@ -404,7 +404,7 @@ error: you seem to want to iterate on a map's values
help: use the corresponding method
|
398 | for v in m.values_mut() {
|
| ^ ^^^^^^^^^^^^^^
error: you seem to want to iterate on a map's values
--> $DIR/for_loop.rs:403:19
@ -414,7 +414,7 @@ error: you seem to want to iterate on a map's values
help: use the corresponding method
|
403 | for v in (*m).values_mut() {
|
| ^ ^^^^^^^^^^^^^^^^^
error: you seem to want to iterate on a map's keys
--> $DIR/for_loop.rs:409:24
@ -424,7 +424,7 @@ error: you seem to want to iterate on a map's keys
help: use the corresponding method
|
409 | for k in rm.keys() {
|
| ^ ^^^^^^^^^
error: it looks like you're manually copying between slices
--> $DIR/for_loop.rs:462:14

View file

@ -8,11 +8,11 @@ error: impl for `HashMap` should be generalized over different hashers
help: consider adding a type parameter
|
11 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashMap<K, V, S> {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
17 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
|
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:20:36
@ -22,11 +22,11 @@ error: impl for `HashMap` should be generalized over different hashers
help: consider adding a type parameter
|
20 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for (HashMap<K, V, S>,) {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
22 | ((HashMap::default(),), (HashMap::with_capacity_and_hasher(10, Default::default()),))
|
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:25:19
@ -36,11 +36,11 @@ error: impl for `HashMap` should be generalized over different hashers
help: consider adding a type parameter
|
25 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashMap<String, String, S> {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
27 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
|
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:43:32
@ -50,11 +50,11 @@ error: impl for `HashSet` should be generalized over different hashers
help: consider adding a type parameter
|
43 | impl<T: Hash + Eq, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashSet<T, S> {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
help: ...and use generic constructor
|
45 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
|
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:48:19
@ -64,11 +64,11 @@ error: impl for `HashSet` should be generalized over different hashers
help: consider adding a type parameter
|
48 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashSet<String, S> {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
50 | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
|
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:65:23
@ -78,7 +78,7 @@ error: parameter of type `HashMap` should be generalized over different hashers
help: consider adding a type parameter
|
65 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:65:53
@ -88,7 +88,7 @@ error: parameter of type `HashSet` should be generalized over different hashers
help: consider adding a type parameter
|
65 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:70:43
@ -101,11 +101,11 @@ error: impl for `HashMap` should be generalized over different hashers
help: consider adding a type parameter
|
70 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
72 | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
|
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:78:33
@ -118,7 +118,7 @@ error: parameter of type `HashMap` should be generalized over different hashers
help: consider adding a type parameter
|
78 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:78:63
@ -131,7 +131,7 @@ error: parameter of type `HashSet` should be generalized over different hashers
help: consider adding a type parameter
|
78 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
error: aborting due to 10 previous errors

View file

@ -65,7 +65,7 @@ error: you don't need to add `&` to all patterns
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
57 | if let None = *a {
|
| ^^^^ ^^
error: you don't need to add `&` to both the expression and the patterns
--> $DIR/matches.rs:62:5
@ -77,7 +77,7 @@ error: you don't need to add `&` to both the expression and the patterns
help: try
|
62 | if let None = b {
|
| ^^^^ ^
error: some ranges overlap
--> $DIR/matches.rs:71:9

View file

@ -1,11 +1,6 @@
#![warn(needless_pass_by_value)]
#![allow(dead_code, single_match, if_let_redundant_pattern_matching, many_single_char_names, option_option)]
#![feature(collections_range)]
use std::borrow::Borrow;
use std::convert::AsRef;
@ -116,8 +111,8 @@ trait FalsePositive {
extern "C" fn ext(x: String) -> usize { x.len() }
// whitelist RangeArgument
fn range<T: ::std::collections::range::RangeArgument<usize>>(range: T) {
let _ = range.start();
fn range<T: ::std::ops::RangeBounds<usize>>(range: T) {
let _ = range.start_bound();
}
struct CopyWrapper(u32);

View file

@ -1,187 +1,187 @@
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:14:23
|
14 | fn foo<T: Default>(v: Vec<T>, w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T> {
| ^^^^^^ help: consider changing the type to: `&[T]`
|
= note: `-D needless-pass-by-value` implied by `-D warnings`
--> $DIR/needless_pass_by_value.rs:9:23
|
9 | fn foo<T: Default>(v: Vec<T>, w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T> {
| ^^^^^^ help: consider changing the type to: `&[T]`
|
= note: `-D needless-pass-by-value` implied by `-D warnings`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:28:11
--> $DIR/needless_pass_by_value.rs:23:11
|
28 | fn bar(x: String, y: Wrapper) {
23 | fn bar(x: String, y: Wrapper) {
| ^^^^^^ help: consider changing the type to: `&str`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:28:22
--> $DIR/needless_pass_by_value.rs:23:22
|
28 | fn bar(x: String, y: Wrapper) {
23 | fn bar(x: String, y: Wrapper) {
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:34:71
--> $DIR/needless_pass_by_value.rs:29:71
|
34 | fn test_borrow_trait<T: Borrow<str>, U: AsRef<str>, V>(t: T, u: U, v: V) {
29 | fn test_borrow_trait<T: Borrow<str>, U: AsRef<str>, V>(t: T, u: U, v: V) {
| ^ help: consider taking a reference instead: `&V`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:46:18
--> $DIR/needless_pass_by_value.rs:41:18
|
46 | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) {
41 | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) {
| ^^^^^^^^^^^^^^^^^^^^^^
help: consider taking a reference instead
|
46 | fn test_match(x: &Option<Option<String>>, y: Option<Option<String>>) {
47 | match *x {
41 | fn test_match(x: &Option<Option<String>>, y: Option<Option<String>>) {
42 | match *x {
|
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:59:24
--> $DIR/needless_pass_by_value.rs:54:24
|
59 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
54 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:59:36
--> $DIR/needless_pass_by_value.rs:54:36
|
59 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
54 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
| ^^^^^^^
help: consider taking a reference instead
|
59 | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) {
60 | let Wrapper(s) = z; // moved
61 | let Wrapper(ref t) = *y; // not moved
62 | let Wrapper(_) = *y; // still not moved
54 | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) {
55 | let Wrapper(s) = z; // moved
56 | let Wrapper(ref t) = *y; // not moved
57 | let Wrapper(_) = *y; // still not moved
|
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:75:49
--> $DIR/needless_pass_by_value.rs:70:49
|
75 | fn test_blanket_ref<T: Foo, S: Serialize>(_foo: T, _serializable: S) {}
70 | fn test_blanket_ref<T: Foo, S: Serialize>(_foo: T, _serializable: S) {}
| ^ help: consider taking a reference instead: `&T`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:77:18
--> $DIR/needless_pass_by_value.rs:72:18
|
77 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
72 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^ help: consider taking a reference instead: `&String`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:77:29
--> $DIR/needless_pass_by_value.rs:72:29
|
77 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
72 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^
help: consider changing the type to
|
77 | fn issue_2114(s: String, t: &str, u: Vec<i32>, v: Vec<i32>) {
72 | fn issue_2114(s: String, t: &str, u: Vec<i32>, v: Vec<i32>) {
| ^^^^
help: change `t.clone()` to
|
79 | let _ = t.to_string();
74 | let _ = t.to_string();
| ^^^^^^^^^^^^^
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:77:40
--> $DIR/needless_pass_by_value.rs:72:40
|
77 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
72 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^^^ help: consider taking a reference instead: `&Vec<i32>`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:77:53
--> $DIR/needless_pass_by_value.rs:72:53
|
77 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
72 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^^^
help: consider changing the type to
|
77 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: &[i32]) {
72 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: &[i32]) {
| ^^^^^^
help: change `v.clone()` to
|
81 | let _ = v.to_owned();
76 | let _ = v.to_owned();
| ^^^^^^^^^^^^
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:89:12
--> $DIR/needless_pass_by_value.rs:84:12
|
89 | s: String,
84 | s: String,
| ^^^^^^ help: consider changing the type to: `&str`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:90:12
--> $DIR/needless_pass_by_value.rs:85:12
|
90 | t: String,
85 | t: String,
| ^^^^^^ help: consider taking a reference instead: `&String`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:102:13
|
102 | _u: U,
| ^ help: consider taking a reference instead: `&U`
--> $DIR/needless_pass_by_value.rs:97:13
|
97 | _u: U,
| ^ help: consider taking a reference instead: `&U`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:103:13
|
103 | _s: Self,
| ^^^^ help: consider taking a reference instead: `&Self`
--> $DIR/needless_pass_by_value.rs:98:13
|
98 | _s: Self,
| ^^^^ help: consider taking a reference instead: `&Self`
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:125:24
--> $DIR/needless_pass_by_value.rs:120:24
|
125 | fn bar_copy(x: u32, y: CopyWrapper) {
120 | fn bar_copy(x: u32, y: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
|
help: consider marking this type as Copy
--> $DIR/needless_pass_by_value.rs:123:1
--> $DIR/needless_pass_by_value.rs:118:1
|
123 | struct CopyWrapper(u32);
118 | struct CopyWrapper(u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:131:29
--> $DIR/needless_pass_by_value.rs:126:29
|
131 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
126 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
|
help: consider marking this type as Copy
--> $DIR/needless_pass_by_value.rs:123:1
--> $DIR/needless_pass_by_value.rs:118:1
|
123 | struct CopyWrapper(u32);
118 | struct CopyWrapper(u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:131:45
--> $DIR/needless_pass_by_value.rs:126:45
|
131 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
126 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
| ^^^^^^^^^^^
|
help: consider marking this type as Copy
--> $DIR/needless_pass_by_value.rs:123:1
--> $DIR/needless_pass_by_value.rs:118:1
|
123 | struct CopyWrapper(u32);
118 | struct CopyWrapper(u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^
help: consider taking a reference instead
|
131 | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) {
132 | let CopyWrapper(s) = z; // moved
133 | let CopyWrapper(ref t) = *y; // not moved
134 | let CopyWrapper(_) = *y; // still not moved
126 | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) {
127 | let CopyWrapper(s) = z; // moved
128 | let CopyWrapper(ref t) = *y; // not moved
129 | let CopyWrapper(_) = *y; // still not moved
|
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:131:61
--> $DIR/needless_pass_by_value.rs:126:61
|
131 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
126 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
| ^^^^^^^^^^^
|
help: consider marking this type as Copy
--> $DIR/needless_pass_by_value.rs:123:1
--> $DIR/needless_pass_by_value.rs:118:1
|
123 | struct CopyWrapper(u32);
118 | struct CopyWrapper(u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^
help: consider taking a reference instead
|
131 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) {
132 | let CopyWrapper(s) = *z; // moved
126 | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) {
127 | let CopyWrapper(s) = *z; // moved
|
error: aborting due to 20 previous errors

View file

@ -8,7 +8,7 @@ error: the loop variable `i` is only used to index `ns`.
help: consider using an iterator
|
8 | for <item> in ns.iter().take(10).skip(3) {
|
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the loop variable `i` is only used to index `ms`.
--> $DIR/needless_range_loop.rs:29:14
@ -18,7 +18,7 @@ error: the loop variable `i` is only used to index `ms`.
help: consider using an iterator
|
29 | for <item> in &mut ms {
|
| ^^^^^^ ^^^^^^^
error: the loop variable `i` is only used to index `ms`.
--> $DIR/needless_range_loop.rs:35:14
@ -28,7 +28,7 @@ error: the loop variable `i` is only used to index `ms`.
help: consider using an iterator
|
35 | for <item> in &mut ms {
|
| ^^^^^^ ^^^^^^^
error: aborting due to 3 previous errors

View file

@ -8,7 +8,7 @@ error: needlessly taken reference of both operands
help: use the values directly
|
13 | let foo = 5 - 6;
|
| ^ ^
error: taken reference of right operand
--> $DIR/op_ref.rs:21:8