Add some examples to std::string#30770
Conversation
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
|
I think in order to actually fix #30345 there should be a mention of the word "concatenation", perhaps in the description and examples for |
src/libcollections/string.rs
Outdated
There was a problem hiding this comment.
Should probably be:
assert_eq!(bytes, [240, 159, 146, 150]);There was a problem hiding this comment.
For what reason?
|
Good call on putting the word 'concatenation' |
src/libcollections/string.rs
Outdated
There was a problem hiding this comment.
and the arguments still need to be swapped because PartialEq<Vec<u8>> is not implemented for [u8; 4]
There was a problem hiding this comment.
ugh, how did this pass for me locally, then?
There was a problem hiding this comment.
What's your test setup / make command?
On Jan 8, 2016 11:02, "Steve Klabnik" notifications@github.com wrote:
In src/libcollections/string.rs
#30770 (comment):+//!
+//! +//! If you have a vector of valid UTF-8 bytes, you can make aStringout of +//! it. You can do the reverse too. +//! +//!rust
+//! let sparkle_heart = vec![240, 159, 146, 150];
+//!
+//! // We know these bytes are valid, so we'll useunwrap().
+//! let sparkle_heart = String::from_utf8(sparkle_heart).unwrap();
+//!
+//! assert_eq!("💖", sparkle_heart);
+//!
+//! let bytes = sparkle_heart.into_bytes();
+//!
+//! assert_eq([240, 159, 146, 150], bytes);ugh, how did this pass for me locally, then?
—
Reply to this email directly or view it on GitHub
https://github.com/rust-lang/rust/pull/30770/files#r49203568.
|
@bors r+ |
|
📌 Commit 51b11ca has been approved by |
|
⌛ Testing commit 51b11ca with merge 18f97a7... |
|
💔 Test failed - auto-mac-64-nopt-t |
|
@bors: r=brson rollup :( |
|
📌 Commit b6cc099 has been approved by |
Fixes rust-lang#30345 I'm not sure if there's anything else that belongs here. Thoughts?
Fixes #30345
I'm not sure if there's anything else that belongs here. Thoughts?