Skip to content
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

trpl/traits: Make error message consistent with source code snippet #25512

Merged
merged 2 commits into from
May 19, 2015
Merged

trpl/traits: Make error message consistent with source code snippet #25512

merged 2 commits into from
May 19, 2015

Conversation

peferron
Copy link
Contributor

The source code snippet uses "whatever".as_bytes() but the compilation error message uses b"whatever". Both should be consistent with each other.

r? @steveklabnik

The source code uses `"whatever".as_bytes()`, not `b"whatever"`.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@alexcrichton
Copy link
Member

In this case I think it's actually somewhat more idiomatic to use the b"..." syntax, perhaps the code snippet could be updated instead to use that?

@peferron
Copy link
Contributor Author

As a Rust beginner who started two days ago, I'll take your word for b"..." being more idiomatic, but it would likely need a short explanation. "...".as_bytes() is self-explanatory and already introduced in the preceding Strings section, but b"..." would have sent me googling to confirm that it's indeed shorthand for "...".as_bytes().

If b"..." is better then please confirm and I'll update the PR and add a short explanation.

@alexcrichton
Copy link
Member

Ah yeah I think it'd be fine to add a few words saying that b".." is a byte-string and distinct from &str

The byte string literal syntax `b"whatever"` is more idiomatic than
`"whatever".as_bytes()`.
@peferron
Copy link
Contributor Author

@alexcrichton How about now?

@alexcrichton
Copy link
Member

@bors: r+ a10d243 rollup

Thanks!

@steveklabnik
Copy link
Member

Thank you!

steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 18, 2015
…excrichton

The source code snippet uses `"whatever".as_bytes()` but the compilation error message uses `b"whatever"`. Both should be consistent with each other.

r? @steveklabnik
Manishearth added a commit to Manishearth/rust that referenced this pull request May 19, 2015
…excrichton

The source code snippet uses `"whatever".as_bytes()` but the compilation error message uses `b"whatever"`. Both should be consistent with each other.

r? @steveklabnik
bors added a commit that referenced this pull request May 19, 2015
@bors bors merged commit a10d243 into rust-lang:master May 19, 2015
@peferron peferron deleted the doc-traits-error-fix branch May 19, 2015 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants