-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect unused struct impls pub trait
- Loading branch information
Showing
8 changed files
with
119 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#![deny(dead_code)] | ||
|
||
enum Foo {} //~ ERROR enum `Foo` is never used | ||
|
||
impl Clone for Foo { | ||
fn clone(&self) -> Foo { loop {} } | ||
} | ||
|
||
pub trait PubTrait { | ||
fn unused_method(&self) -> Self; | ||
} | ||
|
||
impl PubTrait for Foo { | ||
fn unused_method(&self) -> Foo { loop {} } | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: enum `Foo` is never used | ||
--> $DIR/unused-adt-impls-pub-trait.rs:3:6 | ||
| | ||
LL | enum Foo {} | ||
| ^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/unused-adt-impls-pub-trait.rs:1:9 | ||
| | ||
LL | #![deny(dead_code)] | ||
| ^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//@ run-pass | ||
//@ check-pass | ||
//@ edition:2018 | ||
//@ aux-crate:issue_55779_extern_trait=issue-55779-extern-trait.rs | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//@ run-pass | ||
//@ check-pass | ||
use std::ops::AddAssign; | ||
|
||
struct Int(#[allow(dead_code)] i32); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//@ run-pass | ||
//@ check-pass | ||
|
||
struct Foo<A: Repr>(<A as Repr>::Data); | ||
|
||
|