Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Used Self more liberally #9

Closed
wants to merge 1 commit into from
Closed

Used Self more liberally #9

wants to merge 1 commit into from

Conversation

ketsuban
Copy link
Contributor

You're using the Self type annotation in your implementations of Default and From, but you're not referring to the type Self in the method bodies, which is the whole point of the annotation. :)

The whole point of the Self type annotation for traits is so you can
refer to the type in question without adding another location to change
the name of the type when refactoring the code.
@CryZe
Copy link
Contributor

CryZe commented Jan 24, 2016

It's because you can't do that. This doesn't build. Looks like we need Travis CI here.

@ketsuban
Copy link
Contributor Author

Yeah, I only just got around to actually trying to compile—it seemed so obvious I didn't think I'd need to check right away! The error message is very strange, too, telling you there's no associated item for the type you're implementing the trait on. I'll go file an issue on Rust.

@ketsuban ketsuban closed this Jan 24, 2016
@yupferris
Copy link
Owner

Anywhere I can track this issue?

@ketsuban
Copy link
Contributor Author

I filed it here.

@CryZe
Copy link
Contributor

CryZe commented Jan 25, 2016

Most of the discussion is happening here apparently though: rust-lang/rust#31179

@yupferris
Copy link
Owner

Thanks guys!

@ketsuban ketsuban deleted the self-is-shorter branch January 26, 2016 03:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants