Skip to content

cleanup: s/v.slice*()/&v[a..b]/g + remove redundant as_slice() calls #21680

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

Merged
merged 1 commit into from
Jan 29, 2015

Conversation

japaric
Copy link
Member

@japaric japaric commented Jan 27, 2015

Replaces slice_* method calls with slicing syntax, and removes as_slice() calls that are redundant due to Deref.

@rust-highfive
Copy link
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

@bors: r+ 02dd786

<3 this cleanup

@@ -155,7 +155,7 @@ impl<'a> Iterator for MutDnaSeqs<'a> {
fn next(&mut self) -> Option<&'a mut [u8]> {
let tmp = std::mem::replace(&mut self.s, &mut []);
let tmp = match memchr(tmp, b'\n') {
Some(i) => tmp.slice_from_mut(i + 1),
Some(i) => &mut tmp[i + 1..],
Copy link
Member

Choose a reason for hiding this comment

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

Is this equivalent to (i+1)..? Seems a bit surprising given how .. looks like it's attached to 1.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, and yes. I think some people tend to write i+1.. (no spaces), to improve readability, but I think we don't have a convention for this (yet).

@japaric
Copy link
Member Author

japaric commented Jan 27, 2015

@bors: r=alexcrichton bce81e2

@bors
Copy link
Collaborator

bors commented Jan 27, 2015

⌛ Testing commit bce81e2 with merge 2e4990e...

bors added a commit that referenced this pull request Jan 27, 2015
Replaces `slice_*` method calls with slicing syntax, and removes `as_slice()` calls that are redundant due to `Deref`.
@bors
Copy link
Collaborator

bors commented Jan 27, 2015

💔 Test failed - auto-win-32-nopt-t

@alexcrichton
Copy link
Member

@bors: retry

@bors
Copy link
Collaborator

bors commented Jan 28, 2015

⌛ Testing commit bce81e2 with merge 7152b50...

@bors
Copy link
Collaborator

bors commented Jan 28, 2015

💔 Test failed - auto-linux-32-nopt-t

@japaric
Copy link
Member Author

japaric commented Jan 28, 2015

@bors: retry

bors added a commit that referenced this pull request Jan 29, 2015
Replaces `slice_*` method calls with slicing syntax, and removes `as_slice()` calls that are redundant due to `Deref`.
@bors
Copy link
Collaborator

bors commented Jan 29, 2015

⌛ Testing commit bce81e2 with merge bedd810...

@bors
Copy link
Collaborator

bors commented Jan 29, 2015

@bors bors merged commit bce81e2 into rust-lang:master Jan 29, 2015
@japaric japaric deleted the slice branch January 29, 2015 12:45
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.

6 participants