mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Add tests
This commit is contained in:
parent
cd3d38aa27
commit
c6477eb711
4 changed files with 36 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
// run-rustfix
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(custom_inner_attributes, lint_reasons, rustc_private)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::uninlined_format_args,
|
||||
|
@ -491,3 +491,14 @@ mod issue_9782_method_variant {
|
|||
S.foo::<&[u8; 100]>(&a);
|
||||
}
|
||||
}
|
||||
|
||||
extern crate rustc_lint;
|
||||
extern crate rustc_span;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod span_lint {
|
||||
use rustc_lint::{LateContext, Lint, LintContext};
|
||||
fn foo(cx: &LateContext<'_>, lint: &'static Lint) {
|
||||
cx.struct_span_lint(lint, rustc_span::Span::default(), "", |diag| diag.note(&String::new()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-rustfix
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(custom_inner_attributes, lint_reasons, rustc_private)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::uninlined_format_args,
|
||||
|
@ -491,3 +491,14 @@ mod issue_9782_method_variant {
|
|||
S.foo::<&[u8; 100]>(&a);
|
||||
}
|
||||
}
|
||||
|
||||
extern crate rustc_lint;
|
||||
extern crate rustc_span;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod span_lint {
|
||||
use rustc_lint::{LateContext, Lint, LintContext};
|
||||
fn foo(cx: &LateContext<'_>, lint: &'static Lint) {
|
||||
cx.struct_span_lint(lint, rustc_span::Span::default(), "", |diag| diag.note(&String::new()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,3 +239,9 @@ fn false_negative_5707() {
|
|||
let _z = x.clone(); // pr 7346 can't lint on `x`
|
||||
drop(y);
|
||||
}
|
||||
|
||||
#[allow(unused, clippy::manual_retain)]
|
||||
fn possible_borrower_improvements() {
|
||||
let mut s = String::from("foobar");
|
||||
s = s.chars().filter(|&c| c != 'o').to_owned().collect();
|
||||
}
|
||||
|
|
|
@ -239,3 +239,9 @@ fn false_negative_5707() {
|
|||
let _z = x.clone(); // pr 7346 can't lint on `x`
|
||||
drop(y);
|
||||
}
|
||||
|
||||
#[allow(unused, clippy::manual_retain)]
|
||||
fn possible_borrower_improvements() {
|
||||
let mut s = String::from("foobar");
|
||||
s = s.chars().filter(|&c| c != 'o').to_owned().collect();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue