mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 01:05:39 +03:00
47b987eccb
Pointing to the missing method definition in external crates will use paths which depend on the system, and even on the Rust compiler version used when the iterator is defined in the standard library. When the trait being implemented and whose method is missing is external, point only to the trait implementation. The user will be able to figure out, or even navigate using their IDE, to the proper definition. As a side-effect, this will remove a large lintcheck churn at every Rustup for this lint.
72 lines
1.0 KiB
Rust
72 lines
1.0 KiB
Rust
#![allow(unused, clippy::needless_lifetimes)]
|
|
#![warn(clippy::missing_trait_methods)]
|
|
|
|
trait A {
|
|
fn provided() {}
|
|
}
|
|
|
|
trait B {
|
|
fn required();
|
|
|
|
fn a(_: usize) -> usize {
|
|
1
|
|
}
|
|
|
|
fn b<'a, T: AsRef<[u8]>>(a: &'a T) -> &'a [u8] {
|
|
a.as_ref()
|
|
}
|
|
}
|
|
|
|
struct Partial;
|
|
|
|
impl A for Partial {}
|
|
//~^ missing_trait_methods
|
|
|
|
impl B for Partial {
|
|
//~^ missing_trait_methods
|
|
|
|
fn required() {}
|
|
|
|
fn a(_: usize) -> usize {
|
|
2
|
|
}
|
|
}
|
|
|
|
struct Complete;
|
|
|
|
impl A for Complete {
|
|
fn provided() {}
|
|
}
|
|
|
|
impl B for Complete {
|
|
fn required() {}
|
|
|
|
fn a(_: usize) -> usize {
|
|
2
|
|
}
|
|
|
|
fn b<T: AsRef<[u8]>>(a: &T) -> &[u8] {
|
|
a.as_ref()
|
|
}
|
|
}
|
|
|
|
trait MissingMultiple {
|
|
fn one() {}
|
|
fn two() {}
|
|
fn three() {}
|
|
}
|
|
|
|
impl MissingMultiple for Partial {}
|
|
//~^ missing_trait_methods
|
|
//~| missing_trait_methods
|
|
//~| missing_trait_methods
|
|
|
|
fn main() {}
|
|
|
|
//~v missing_trait_methods
|
|
impl PartialEq<Partial> for Partial {
|
|
fn eq(&self, other: &Partial) -> bool {
|
|
todo!()
|
|
}
|
|
}
|