Skip to content

Split up use_self ui test #5033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2020
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
111 changes: 0 additions & 111 deletions tests/ui/use_self.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -69,117 +69,6 @@ mod lifetimes {
}
}

#[allow(clippy::boxed_local)]
mod traits {

use std::ops::Mul;

trait SelfTrait {
fn refs(p1: &Self) -> &Self;
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self;
fn mut_refs(p1: &mut Self) -> &mut Self;
fn nested(p1: Box<Self>, p2: (&u8, &Self));
fn vals(r: Self) -> Self;
}

#[derive(Default)]
struct Bad;

impl SelfTrait for Bad {
fn refs(p1: &Self) -> &Self {
p1
}

fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
p1
}

fn mut_refs(p1: &mut Self) -> &mut Self {
p1
}

fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}

fn vals(_: Self) -> Self {
Self::default()
}
}

impl Mul for Bad {
type Output = Self;

fn mul(self, rhs: Self) -> Self {
rhs
}
}

impl Clone for Bad {
fn clone(&self) -> Self {
Self
}
}

#[derive(Default)]
struct Good;

impl SelfTrait for Good {
fn refs(p1: &Self) -> &Self {
p1
}

fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
p1
}

fn mut_refs(p1: &mut Self) -> &mut Self {
p1
}

fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}

fn vals(_: Self) -> Self {
Self::default()
}
}

impl Mul for Good {
type Output = Self;

fn mul(self, rhs: Self) -> Self {
rhs
}
}

trait NameTrait {
fn refs(p1: &u8) -> &u8;
fn ref_refs<'a>(p1: &'a &'a u8) -> &'a &'a u8;
fn mut_refs(p1: &mut u8) -> &mut u8;
fn nested(p1: Box<u8>, p2: (&u8, &u8));
fn vals(p1: u8) -> u8;
}

// Using `Self` instead of the type name is OK
impl NameTrait for u8 {
fn refs(p1: &Self) -> &Self {
p1
}

fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
p1
}

fn mut_refs(p1: &mut Self) -> &mut Self {
p1
}

fn nested(_p1: Box<Self>, _p2: (&Self, &Self)) {}

fn vals(_: Self) -> Self {
Self::default()
}
}
}

mod issue2894 {
trait IntoBytes {
fn into_bytes(&self) -> Vec<u8>;
Expand Down
111 changes: 0 additions & 111 deletions tests/ui/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,117 +69,6 @@ mod lifetimes {
}
}

#[allow(clippy::boxed_local)]
mod traits {

use std::ops::Mul;

trait SelfTrait {
fn refs(p1: &Self) -> &Self;
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self;
fn mut_refs(p1: &mut Self) -> &mut Self;
fn nested(p1: Box<Self>, p2: (&u8, &Self));
fn vals(r: Self) -> Self;
}

#[derive(Default)]
struct Bad;

impl SelfTrait for Bad {
fn refs(p1: &Bad) -> &Bad {
p1
}

fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
p1
}

fn mut_refs(p1: &mut Bad) -> &mut Bad {
p1
}

fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}

fn vals(_: Bad) -> Bad {
Bad::default()
}
}

impl Mul for Bad {
type Output = Bad;

fn mul(self, rhs: Bad) -> Bad {
rhs
}
}

impl Clone for Bad {
fn clone(&self) -> Self {
Bad
}
}

#[derive(Default)]
struct Good;

impl SelfTrait for Good {
fn refs(p1: &Self) -> &Self {
p1
}

fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
p1
}

fn mut_refs(p1: &mut Self) -> &mut Self {
p1
}

fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}

fn vals(_: Self) -> Self {
Self::default()
}
}

impl Mul for Good {
type Output = Self;

fn mul(self, rhs: Self) -> Self {
rhs
}
}

trait NameTrait {
fn refs(p1: &u8) -> &u8;
fn ref_refs<'a>(p1: &'a &'a u8) -> &'a &'a u8;
fn mut_refs(p1: &mut u8) -> &mut u8;
fn nested(p1: Box<u8>, p2: (&u8, &u8));
fn vals(p1: u8) -> u8;
}

// Using `Self` instead of the type name is OK
impl NameTrait for u8 {
fn refs(p1: &Self) -> &Self {
p1
}

fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
p1
}

fn mut_refs(p1: &mut Self) -> &mut Self {
p1
}

fn nested(_p1: Box<Self>, _p2: (&Self, &Self)) {}

fn vals(_: Self) -> Self {
Self::default()
}
}
}

mod issue2894 {
trait IntoBytes {
fn into_bytes(&self) -> Vec<u8>;
Expand Down
Loading