Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clippy_lints/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ impl LintPass for CharLitAsU8 {

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CharLitAsU8 {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
use syntax::ast::{LitKind, UintTy};
use syntax::ast::LitKind;

if let ExprKind::Cast(ref e, _) = expr.node {
if let ExprKind::Lit(ref l) = e.node {
Expand Down Expand Up @@ -1818,7 +1818,6 @@ impl Ord for FullInt {

fn numeric_cast_precast_bounds<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr) -> Option<(FullInt, FullInt)> {
use std::*;
use syntax::ast::{IntTy, UintTy};

if let ExprKind::Cast(ref cast_exp, _) = expr.node {
let pre_cast_ty = cx.tables.expr_ty(cast_exp);
Expand Down
1 change: 1 addition & 0 deletions tests/ui/use_self.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ mod nesting {
struct Foo {}
impl Foo {
fn foo() {
#[allow(unused_imports)]
use self::Foo; // Can't use Self here
struct Bar {
foo: Foo, // Foo != Self
Expand Down
1 change: 1 addition & 0 deletions tests/ui/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ mod nesting {
struct Foo {}
impl Foo {
fn foo() {
#[allow(unused_imports)]
use self::Foo; // Can't use Self here
struct Bar {
foo: Foo, // Foo != Self
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/use_self.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -151,43 +151,43 @@ LL | use_self_expand!(); // Should lint in local macros
| ------------------- in this macro invocation

error: unnecessary structure name repetition
--> $DIR/use_self.rs:260:21
--> $DIR/use_self.rs:261:21
|
LL | fn baz() -> Foo {
| ^^^ help: use the applicable keyword: `Self`

error: unnecessary structure name repetition
--> $DIR/use_self.rs:261:13
--> $DIR/use_self.rs:262:13
|
LL | Foo {}
| ^^^ help: use the applicable keyword: `Self`

error: unnecessary structure name repetition
--> $DIR/use_self.rs:248:29
--> $DIR/use_self.rs:249:29
|
LL | fn bar() -> Bar {
| ^^^ help: use the applicable keyword: `Self`

error: unnecessary structure name repetition
--> $DIR/use_self.rs:249:21
--> $DIR/use_self.rs:250:21
|
LL | Bar { foo: Foo {} }
| ^^^ help: use the applicable keyword: `Self`

error: unnecessary structure name repetition
--> $DIR/use_self.rs:303:13
--> $DIR/use_self.rs:304:13
|
LL | nested::A::fun_1();
| ^^^^^^^^^ help: use the applicable keyword: `Self`

error: unnecessary structure name repetition
--> $DIR/use_self.rs:304:13
--> $DIR/use_self.rs:305:13
|
LL | nested::A::A;
| ^^^^^^^^^ help: use the applicable keyword: `Self`

error: unnecessary structure name repetition
--> $DIR/use_self.rs:306:13
--> $DIR/use_self.rs:307:13
|
LL | nested::A {};
| ^^^^^^^^^ help: use the applicable keyword: `Self`
Expand Down