Skip to content

More str cleanup #7123

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

Closed
wants to merge 7 commits into from
Closed

More str cleanup #7123

wants to merge 7 commits into from

Conversation

huonw
Copy link
Member

@huonw huonw commented Jun 14, 2013

Moves all the remaining functions that could reasonably be methods to be methods, except for some FFI ones (which I believe @erickt is working on, possibly) and each_split_within, since I'm not really sure the details of it (I believe @Kimundi wrote the current implementation, so maybe he could convert it to an external iterator method on StrSlice, e.g. word_wrap_iter(&self) -> WordWrapIterator<'self>, where WordWrapIterator impls Iterator<&'self str>. It probably won't be too hard, since it's already a state machine.)

This also cleans up the comparison impls for the string types, except I'm not sure how the lang items eq_str and eq_str_uniq need to be handled, so they (eq_slice and eq) remain stand-alone functions.

@Kimundi
Copy link
Member

Kimundi commented Jun 14, 2013

@huonw each_split_within() is basically just used by one place in extra::getops, and the usage there is wrong anyway (It assumes bytes == graphemes). I can look into converting it, but maybe it's just best left alone/moved to extra::getops until there is proper grapheme support to replace/improve it.

@huonw
Copy link
Member Author

huonw commented Jun 15, 2013

@Kimundi I see. Moving it to extra::getopts sounds like a good idea for now.

@@ -22,6 +22,7 @@ use markdown_writer::WriterFactory;
use pass::Pass;
use sort_pass;

use core::iterator::IteratorUtil;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IteratorUtil is in prelude now, so this could be removed

bors added a commit that referenced this pull request Jun 16, 2013
Moves all the remaining functions that could reasonably be methods to be methods, except for some FFI ones (which I believe @erickt is working on, possibly) and `each_split_within`, since I'm not really sure the details of it (I believe @Kimundi wrote the current implementation, so maybe he could convert it to an external iterator method on `StrSlice`, e.g. `word_wrap_iter(&self) -> WordWrapIterator<'self>`, where `WordWrapIterator` impls `Iterator<&'self str>`. It probably won't be too hard, since it's already a state machine.)

This also cleans up the comparison impls for the string types, except I'm not sure how the lang items `eq_str` and `eq_str_uniq` need to be handled, so they (`eq_slice` and `eq`) remain stand-alone functions.
@bors bors closed this Jun 16, 2013
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.

4 participants