mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-12 20:16:49 +00:00
Test fixes
This commit is contained in:
parent
667223c35d
commit
555f5a49a2
@ -100,10 +100,7 @@ pub fn run(check: bool, verbose: bool) {
|
||||
}
|
||||
|
||||
fn format_command(program: impl AsRef<OsStr>, dir: impl AsRef<Path>, args: &[impl AsRef<OsStr>]) -> String {
|
||||
let arg_display: Vec<_> = args
|
||||
.iter()
|
||||
.map(|a| escape(a.as_ref().to_string_lossy()).to_owned())
|
||||
.collect();
|
||||
let arg_display: Vec<_> = args.iter().map(|a| escape(a.as_ref().to_string_lossy())).collect();
|
||||
|
||||
format!(
|
||||
"cd {} && {} {}",
|
||||
|
@ -38,8 +38,7 @@ fn config(mode: &str, dir: PathBuf) -> compiletest::Config {
|
||||
|
||||
let cfg_mode = mode.parse().expect("Invalid mode");
|
||||
if let Ok(name) = var::<&str>("TESTNAME") {
|
||||
let s: String = name.to_owned();
|
||||
config.filter = Some(s)
|
||||
config.filter = Some(name)
|
||||
}
|
||||
|
||||
if rustc_test_suite().is_some() {
|
||||
|
@ -30,7 +30,7 @@ pub fn macro_test(input_stream: TokenStream) -> TokenStream {
|
||||
TokenTree::Ident(Ident::new("true", Span::call_site())),
|
||||
TokenTree::Group(clause.clone()),
|
||||
TokenTree::Ident(Ident::new("else", Span::call_site())),
|
||||
TokenTree::Group(clause.clone()),
|
||||
TokenTree::Group(clause),
|
||||
])
|
||||
})),
|
||||
])
|
||||
|
@ -1,5 +1,10 @@
|
||||
#![feature(box_syntax)]
|
||||
#![allow(clippy::borrowed_box, clippy::needless_pass_by_value, clippy::unused_unit)]
|
||||
#![allow(
|
||||
clippy::borrowed_box,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::unused_unit,
|
||||
clippy::redundant_clone
|
||||
)]
|
||||
#![warn(clippy::boxed_local)]
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> $DIR/escape_analysis.rs:34:13
|
||||
--> $DIR/escape_analysis.rs:39:13
|
||||
|
|
||||
LL | fn warn_arg(x: Box<A>) {
|
||||
| ^
|
||||
@ -7,13 +7,13 @@ LL | fn warn_arg(x: Box<A>) {
|
||||
= note: `-D clippy::boxed-local` implied by `-D warnings`
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> $DIR/escape_analysis.rs:125:12
|
||||
--> $DIR/escape_analysis.rs:130:12
|
||||
|
|
||||
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> $DIR/escape_analysis.rs:165:23
|
||||
--> $DIR/escape_analysis.rs:170:23
|
||||
|
|
||||
LL | fn closure_borrow(x: Box<A>) {
|
||||
| ^
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
#![warn(clippy::all, clippy::pedantic)]
|
||||
#![allow(clippy::iter_cloned_collect)]
|
||||
#![allow(clippy::clone_on_copy)]
|
||||
#![allow(clippy::clone_on_copy, clippy::redundant_clone)]
|
||||
#![allow(clippy::missing_docs_in_private_items)]
|
||||
#![allow(clippy::redundant_closure_for_method_calls)]
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
#![warn(clippy::all, clippy::pedantic)]
|
||||
#![allow(clippy::iter_cloned_collect)]
|
||||
#![allow(clippy::clone_on_copy)]
|
||||
#![allow(clippy::clone_on_copy, clippy::redundant_clone)]
|
||||
#![allow(clippy::missing_docs_in_private_items)]
|
||||
#![allow(clippy::redundant_closure_for_method_calls)]
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
clippy::single_match,
|
||||
clippy::redundant_pattern_matching,
|
||||
clippy::many_single_char_names,
|
||||
clippy::option_option
|
||||
clippy::option_option,
|
||||
clippy::redundant_clone
|
||||
)]
|
||||
|
||||
use std::borrow::Borrow;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this argument is passed by value, but not consumed in the function body
|
||||
--> $DIR/needless_pass_by_value.rs:16:23
|
||||
--> $DIR/needless_pass_by_value.rs:17:23
|
||||
|
|
||||
LL | 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]`
|
||||
@ -7,25 +7,25 @@ LL | fn foo<T: Default>(v: Vec<T>, w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T
|
||||
= note: `-D clippy::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:30:11
|
||||
--> $DIR/needless_pass_by_value.rs:31:11
|
||||
|
|
||||
LL | 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:30:22
|
||||
--> $DIR/needless_pass_by_value.rs:31:22
|
||||
|
|
||||
LL | 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:36:71
|
||||
--> $DIR/needless_pass_by_value.rs:37:71
|
||||
|
|
||||
LL | 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:48:18
|
||||
--> $DIR/needless_pass_by_value.rs:49:18
|
||||
|
|
||||
LL | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -36,13 +36,13 @@ LL | match *x {
|
||||
|
|
||||
|
||||
error: this argument is passed by value, but not consumed in the function body
|
||||
--> $DIR/needless_pass_by_value.rs:61:24
|
||||
--> $DIR/needless_pass_by_value.rs:62:24
|
||||
|
|
||||
LL | 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:61:36
|
||||
--> $DIR/needless_pass_by_value.rs:62:36
|
||||
|
|
||||
LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
|
||||
| ^^^^^^^
|
||||
@ -55,19 +55,19 @@ LL | 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:77:49
|
||||
--> $DIR/needless_pass_by_value.rs:78:49
|
||||
|
|
||||
LL | 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:79:18
|
||||
--> $DIR/needless_pass_by_value.rs:80:18
|
||||
|
|
||||
LL | 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:79:29
|
||||
--> $DIR/needless_pass_by_value.rs:80:29
|
||||
|
|
||||
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
|
||||
| ^^^^^^
|
||||
@ -81,13 +81,13 @@ LL | let _ = t.to_string();
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: this argument is passed by value, but not consumed in the function body
|
||||
--> $DIR/needless_pass_by_value.rs:79:40
|
||||
--> $DIR/needless_pass_by_value.rs:80:40
|
||||
|
|
||||
LL | 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:79:53
|
||||
--> $DIR/needless_pass_by_value.rs:80:53
|
||||
|
|
||||
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
|
||||
| ^^^^^^^^
|
||||
@ -101,61 +101,61 @@ LL | let _ = v.to_owned();
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: this argument is passed by value, but not consumed in the function body
|
||||
--> $DIR/needless_pass_by_value.rs:92:12
|
||||
--> $DIR/needless_pass_by_value.rs:93:12
|
||||
|
|
||||
LL | 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:93:12
|
||||
--> $DIR/needless_pass_by_value.rs:94:12
|
||||
|
|
||||
LL | 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:23
|
||||
--> $DIR/needless_pass_by_value.rs:103:23
|
||||
|
|
||||
LL | fn baz(&self, _u: U, _s: Self) {}
|
||||
| ^ 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:102:30
|
||||
--> $DIR/needless_pass_by_value.rs:103:30
|
||||
|
|
||||
LL | fn baz(&self, _u: U, _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:124:24
|
||||
--> $DIR/needless_pass_by_value.rs:125:24
|
||||
|
|
||||
LL | 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:122:1
|
||||
--> $DIR/needless_pass_by_value.rs:123:1
|
||||
|
|
||||
LL | struct CopyWrapper(u32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this argument is passed by value, but not consumed in the function body
|
||||
--> $DIR/needless_pass_by_value.rs:130:29
|
||||
--> $DIR/needless_pass_by_value.rs:131:29
|
||||
|
|
||||
LL | 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:122:1
|
||||
--> $DIR/needless_pass_by_value.rs:123:1
|
||||
|
|
||||
LL | struct CopyWrapper(u32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this argument is passed by value, but not consumed in the function body
|
||||
--> $DIR/needless_pass_by_value.rs:130:45
|
||||
--> $DIR/needless_pass_by_value.rs:131:45
|
||||
|
|
||||
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
help: consider marking this type as Copy
|
||||
--> $DIR/needless_pass_by_value.rs:122:1
|
||||
--> $DIR/needless_pass_by_value.rs:123:1
|
||||
|
|
||||
LL | struct CopyWrapper(u32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -168,13 +168,13 @@ LL | 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:130:61
|
||||
--> $DIR/needless_pass_by_value.rs:131:61
|
||||
|
|
||||
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
help: consider marking this type as Copy
|
||||
--> $DIR/needless_pass_by_value.rs:122:1
|
||||
--> $DIR/needless_pass_by_value.rs:123:1
|
||||
|
|
||||
LL | struct CopyWrapper(u32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -185,13 +185,13 @@ LL | let CopyWrapper(s) = *z; // moved
|
||||
|
|
||||
|
||||
error: this argument is passed by value, but not consumed in the function body
|
||||
--> $DIR/needless_pass_by_value.rs:142:40
|
||||
--> $DIR/needless_pass_by_value.rs:143:40
|
||||
|
|
||||
LL | fn some_fun<'b, S: Bar<'b, ()>>(_item: S) {}
|
||||
| ^ help: consider taking a reference instead: `&S`
|
||||
|
||||
error: this argument is passed by value, but not consumed in the function body
|
||||
--> $DIR/needless_pass_by_value.rs:147:20
|
||||
--> $DIR/needless_pass_by_value.rs:148:20
|
||||
|
|
||||
LL | fn more_fun(_item: impl Club<'static, i32>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&impl Club<'static, i32>`
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(unused, clippy::many_single_char_names)]
|
||||
#![allow(unused, clippy::many_single_char_names, clippy::redundant_clone)]
|
||||
#![warn(clippy::ptr_arg)]
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
@ -104,7 +104,7 @@ fn main() {
|
||||
};
|
||||
move_struct.ref_func();
|
||||
move_struct.clone().mov_func_reuse();
|
||||
move_struct.clone().mov_func_no_use();
|
||||
move_struct.mov_func_no_use();
|
||||
|
||||
let so = SeemsOption::Some(45);
|
||||
returns_something_similar_to_option(so);
|
||||
|
@ -1,5 +1,11 @@
|
||||
#![warn(clippy::all)]
|
||||
#![allow(clippy::blacklisted_name, clippy::no_effect, redundant_semicolon, unused_assignments)]
|
||||
#![allow(
|
||||
clippy::blacklisted_name,
|
||||
clippy::no_effect,
|
||||
clippy::redundant_clone,
|
||||
redundant_semicolon,
|
||||
unused_assignments
|
||||
)]
|
||||
|
||||
struct Foo(u32);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this looks like you are swapping elements of `foo` manually
|
||||
--> $DIR/swap.rs:27:5
|
||||
--> $DIR/swap.rs:33:5
|
||||
|
|
||||
LL | / let temp = foo[0];
|
||||
LL | | foo[0] = foo[1];
|
||||
@ -9,7 +9,7 @@ LL | | foo[1] = temp;
|
||||
= note: `-D clippy::manual-swap` implied by `-D warnings`
|
||||
|
||||
error: this looks like you are swapping elements of `foo` manually
|
||||
--> $DIR/swap.rs:36:5
|
||||
--> $DIR/swap.rs:42:5
|
||||
|
|
||||
LL | / let temp = foo[0];
|
||||
LL | | foo[0] = foo[1];
|
||||
@ -17,7 +17,7 @@ LL | | foo[1] = temp;
|
||||
| |_________________^ help: try: `foo.swap(0, 1)`
|
||||
|
||||
error: this looks like you are swapping elements of `foo` manually
|
||||
--> $DIR/swap.rs:45:5
|
||||
--> $DIR/swap.rs:51:5
|
||||
|
|
||||
LL | / let temp = foo[0];
|
||||
LL | | foo[0] = foo[1];
|
||||
@ -25,7 +25,7 @@ LL | | foo[1] = temp;
|
||||
| |_________________^ help: try: `foo.swap(0, 1)`
|
||||
|
||||
error: this looks like you are swapping `a` and `b` manually
|
||||
--> $DIR/swap.rs:65:7
|
||||
--> $DIR/swap.rs:71:7
|
||||
|
|
||||
LL | ; let t = a;
|
||||
| _______^
|
||||
@ -36,7 +36,7 @@ LL | | b = t;
|
||||
= note: or maybe you should use `std::mem::replace`?
|
||||
|
||||
error: this looks like you are swapping `c.0` and `a` manually
|
||||
--> $DIR/swap.rs:74:7
|
||||
--> $DIR/swap.rs:80:7
|
||||
|
|
||||
LL | ; let t = c.0;
|
||||
| _______^
|
||||
@ -47,7 +47,7 @@ LL | | a = t;
|
||||
= note: or maybe you should use `std::mem::replace`?
|
||||
|
||||
error: this looks like you are trying to swap `a` and `b`
|
||||
--> $DIR/swap.rs:62:5
|
||||
--> $DIR/swap.rs:68:5
|
||||
|
|
||||
LL | / a = b;
|
||||
LL | | b = a;
|
||||
@ -57,7 +57,7 @@ LL | | b = a;
|
||||
= note: or maybe you should use `std::mem::replace`?
|
||||
|
||||
error: this looks like you are trying to swap `c.0` and `a`
|
||||
--> $DIR/swap.rs:71:5
|
||||
--> $DIR/swap.rs:77:5
|
||||
|
|
||||
LL | / c.0 = a;
|
||||
LL | | a = c.0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// does not test any rustfixable lints
|
||||
|
||||
#![warn(clippy::clone_on_ref_ptr)]
|
||||
#![allow(unused)]
|
||||
#![allow(unused, clippy::redundant_clone)]
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::rc::{self, Rc};
|
||||
|
Loading…
Reference in New Issue
Block a user