-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
doc(str): show example of chars().count() under len() #66038
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (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. Due to 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 the contribution instructions for more information. |
e94b6d5
to
e83533e
Compare
the docs are great at explaining that .len() isn't like in other languages but stops short of explaining how to get the character length. r? @steveklabnik
@@ -2085,8 +2085,8 @@ impl str { | |||
/// let len = "foo".len(); | |||
/// assert_eq!(3, len); | |||
/// | |||
/// let len = "ƒoo".len(); // fancy f! | |||
/// assert_eq!(4, len); | |||
/// assert_eq!("ƒoo".len(), 4); // fancy f! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the rust convention to do assert_eq!(expected, actual)
? or assert_eq!(actual, expected)
?
it looks like String is doing one but str is doing the other
@bors: r+ Looks great, thanks! I don't think we have a super strong convention for the ordering of |
📌 Commit d9ec5fa has been approved by |
doc(str): show example of chars().count() under len() the docs are great at explaining that .len() isn't like in other languages but stops short of explaining how to get the character length.
Rollup of 10 pull requests Successful merges: - #65136 (Update codegen option documentation.) - #65574 (docs: improve disclaimer regarding LinkedList) - #65720 (Add FFI bindings for LLVM's Module::getInstructionCount()) - #65905 ([doc] fixes for unix/vxworks `OpenOptionsExt::mode`) - #65962 (Fix logic in example.) - #66019 (Improved std::iter::Chain documentation) - #66038 (doc(str): show example of chars().count() under len()) - #66042 (Suggest correct code when encountering an incorrect trait bound referencing the current trait) - #66073 (Do not needlessly write-lock) - #66096 (Add a failing UI test for multiple loops of all kinds in a `const`) Failed merges: r? @ghost
the docs are great at explaining that .len() isn't like in other
languages but stops short of explaining how to get the character length.