Skip to content

Commit c6477eb

Browse files
committed
Add tests
1 parent cd3d38a commit c6477eb

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

tests/ui/needless_borrow.fixed

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![feature(lint_reasons)]
2+
#![feature(custom_inner_attributes, lint_reasons, rustc_private)]
33
#![allow(
44
unused,
55
clippy::uninlined_format_args,
@@ -491,3 +491,14 @@ mod issue_9782_method_variant {
491491
S.foo::<&[u8; 100]>(&a);
492492
}
493493
}
494+
495+
extern crate rustc_lint;
496+
extern crate rustc_span;
497+
498+
#[allow(dead_code)]
499+
mod span_lint {
500+
use rustc_lint::{LateContext, Lint, LintContext};
501+
fn foo(cx: &LateContext<'_>, lint: &'static Lint) {
502+
cx.struct_span_lint(lint, rustc_span::Span::default(), "", |diag| diag.note(&String::new()));
503+
}
504+
}

tests/ui/needless_borrow.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![feature(lint_reasons)]
2+
#![feature(custom_inner_attributes, lint_reasons, rustc_private)]
33
#![allow(
44
unused,
55
clippy::uninlined_format_args,
@@ -491,3 +491,14 @@ mod issue_9782_method_variant {
491491
S.foo::<&[u8; 100]>(&a);
492492
}
493493
}
494+
495+
extern crate rustc_lint;
496+
extern crate rustc_span;
497+
498+
#[allow(dead_code)]
499+
mod span_lint {
500+
use rustc_lint::{LateContext, Lint, LintContext};
501+
fn foo(cx: &LateContext<'_>, lint: &'static Lint) {
502+
cx.struct_span_lint(lint, rustc_span::Span::default(), "", |diag| diag.note(&String::new()));
503+
}
504+
}

tests/ui/redundant_clone.fixed

+6
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,9 @@ fn false_negative_5707() {
239239
let _z = x.clone(); // pr 7346 can't lint on `x`
240240
drop(y);
241241
}
242+
243+
#[allow(unused, clippy::manual_retain)]
244+
fn possible_borrower_improvements() {
245+
let mut s = String::from("foobar");
246+
s = s.chars().filter(|&c| c != 'o').to_owned().collect();
247+
}

tests/ui/redundant_clone.rs

+6
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,9 @@ fn false_negative_5707() {
239239
let _z = x.clone(); // pr 7346 can't lint on `x`
240240
drop(y);
241241
}
242+
243+
#[allow(unused, clippy::manual_retain)]
244+
fn possible_borrower_improvements() {
245+
let mut s = String::from("foobar");
246+
s = s.chars().filter(|&c| c != 'o').to_owned().collect();
247+
}

0 commit comments

Comments
 (0)