Skip to content

Use slicing syntax for str/String #17502

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
nrc opened this issue Sep 24, 2014 · 5 comments · Fixed by #17585
Closed

Use slicing syntax for str/String #17502

nrc opened this issue Sep 24, 2014 · 5 comments · Fixed by #17585
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@nrc
Copy link
Member

nrc commented Sep 24, 2014

Need to implement ops::Slice

Happy to mentor.

@nrc nrc added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Sep 24, 2014
@gamazeps
Copy link
Contributor

On it :)

@steveklabnik
Copy link
Member

We removed this for a reason, what's the justification for bringing this back?

@japaric
Copy link
Member

japaric commented Sep 24, 2014

We removed this for a reason

Did we? IIRC, we removed string indexing. But, we still have unsugared string slicing.

what's the justification for bringing this back?

I'd say that the main reason is that string[] is shorter than string.as_slice().

But I'm not sure about the usefulness of the sugared versions of the other three methods: slice, slice_from and slice_to.

@steveklabnik
Copy link
Member

Oh oh, I was thinking of indexing. Carry on 😄

sfackler added a commit to sfackler/rust that referenced this issue Sep 27, 2014
kennytm added a commit to kennytm/qrcode-rust that referenced this issue Sep 27, 2014
* Use ... instead of .. when matching a range, in preparation for
  rust-lang/rust#17584 (may not be complete).
* Use the new slicing syntax (a[], a[x..y]) if possible. (Currently
  String::as_slice() is blocked by rust-lang/rust#17502.)
* Change deprecated String::push_char() to String::push().
@gamazeps
Copy link
Contributor

Arf, I've been too slow ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants