Skip to content
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

Add str::strip_prefix and str::strip_suffix #66735

Merged
merged 4 commits into from Dec 16, 2019

Conversation

SOF3
Copy link
Contributor

@SOF3 SOF3 commented Nov 25, 2019

Introduces a counterpart for Path::strip_prefix on str.

This was also discussed in https://internals.rust-lang.org/t/pre-pr-path-strip-prefix-counterpart-in-str/11364/.

@rust-highfive
Copy link
Collaborator

r? @withoutboats

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 25, 2019
@jonas-schievink jonas-schievink added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Nov 25, 2019
src/libcore/str/mod.rs Outdated Show resolved Hide resolved
src/libcore/str/mod.rs Outdated Show resolved Hide resolved
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-11-26T09:43:47.1613552Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-11-26T09:43:47.7506578Z ##[command]git config gc.auto 0
2019-11-26T09:43:47.7512043Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-11-26T09:43:47.7515935Z ##[command]git config --get-all http.proxy
2019-11-26T09:43:47.7521296Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/66735/merge:refs/remotes/pull/66735/merge
---
2019-11-26T09:49:48.6184500Z    Compiling serde_json v1.0.40
2019-11-26T09:49:50.3584964Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-11-26T09:50:01.1653588Z     Finished release [optimized] target(s) in 1m 29s
2019-11-26T09:50:01.1756885Z tidy check
2019-11-26T09:50:02.0755650Z tidy error: /checkout/src/libcore/str/mod.rs:3817: line longer than 100 chars
2019-11-26T09:50:02.0756400Z tidy error: /checkout/src/libcore/str/mod.rs:3853: line longer than 100 chars
2019-11-26T09:50:04.0115782Z Found 486 error codes
2019-11-26T09:50:04.0115983Z Found 0 error codes with no tests
2019-11-26T09:50:04.0116049Z Done!
2019-11-26T09:50:04.0116091Z some tidy checks failed
2019-11-26T09:50:04.0116091Z some tidy checks failed
2019-11-26T09:50:04.0116122Z 
2019-11-26T09:50:04.0116148Z 
2019-11-26T09:50:04.0117104Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-11-26T09:50:04.0117215Z 
2019-11-26T09:50:04.0117241Z 
2019-11-26T09:50:04.0121473Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-11-26T09:50:04.0121548Z Build completed unsuccessfully in 0:01:33
2019-11-26T09:50:04.0121548Z Build completed unsuccessfully in 0:01:33
2019-11-26T09:50:04.0173203Z == clock drift check ==
2019-11-26T09:50:04.0183789Z   local time: Tue Nov 26 09:50:04 UTC 2019
2019-11-26T09:50:04.1675317Z   network time: Tue, 26 Nov 2019 09:50:04 GMT
2019-11-26T09:50:04.1675505Z == end clock drift check ==
2019-11-26T09:50:05.5137396Z 
2019-11-26T09:50:05.5210336Z ##[error]Bash exited with code '1'.
2019-11-26T09:50:05.5239511Z ##[section]Starting: Checkout
2019-11-26T09:50:05.5241761Z ==============================================================================
2019-11-26T09:50:05.5241818Z Task         : Get sources
2019-11-26T09:50:05.5241881Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@Alexendoo
Copy link
Member

Ping from triage, any updates? @withoutboats

@Dylan-DPC-zz
Copy link

r? @KodrAus

@rust-highfive rust-highfive assigned KodrAus and unassigned withoutboats Dec 4, 2019
Copy link
Contributor

@KodrAus KodrAus left a comment

Choose a reason for hiding this comment

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

Naming wise it looks like we've got a few schemes going here: trim vs strip and start/end vs prefix/suffix.

Personally, I think strip_prefix and strip_suffix are nicely discoverable names, and this API is distinct enough from the trim ones in the way it operates that it doesn't seem necessary to me to make them consistent. They can sit out as distinct so users don't have to try compare signatures to see what makes them different.

So this looks good to me! I'll open up a tracking issue and circle back, but r=me if anybody beats me to it 🙂

@Dylan-DPC-zz
Copy link

@KodrAus can I merge this?

@JohnCSimon
Copy link
Member

Ping from triage - @KodrAus , see Dylan-DPC's comment

@CAD97
Copy link
Contributor

CAD97 commented Dec 14, 2019

This still needs the tracking issue created and to be linked up to, then r=@KodrAus.

@Dylan-DPC-zz
Copy link

Yes. But I don't want to keep the Pr hanging on an issue creation which can happen at a later stage as well

@Dylan-DPC-zz
Copy link

I've created the tracking issue (#67302)

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 14, 2019

📌 Commit 4718e20 has been approved by Dylan-DPC

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 14, 2019
@dtolnay
Copy link
Member

dtolnay commented Dec 15, 2019

Yes. But I don't want to keep the Pr hanging on an issue creation which can happen at a later stage as well

The PR can't land before tracking issue creation because the issue number needs to go inside the #[unstable(...)] attribute. We shouldn't be merging unstable methods with issue = "0".

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 15, 2019
src/libcore/str/mod.rs Outdated Show resolved Hide resolved
@Dylan-DPC-zz
Copy link

Ah right, my bad 😆

@KodrAus
Copy link
Contributor

KodrAus commented Dec 16, 2019

Whoops! Looks like I preempted my own dropping of the ball here. Thanks for opening the tracking issue @Dylan-DPC.

@bors r+

@bors
Copy link
Contributor

bors commented Dec 16, 2019

📌 Commit 6176051 has been approved by KodrAus

@bors
Copy link
Contributor

bors commented Dec 16, 2019

🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 16, 2019
Centril added a commit to Centril/rust that referenced this pull request Dec 16, 2019
Add str::strip_prefix and str::strip_suffix

Introduces a counterpart for `Path::strip_prefix` on `str`.

This was also discussed in https://internals.rust-lang.org/t/pre-pr-path-strip-prefix-counterpart-in-str/11364/.
bors added a commit that referenced this pull request Dec 16, 2019
Rollup of 7 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #66735 (Add str::strip_prefix and str::strip_suffix)
 - #66771 (Stabilize the `core::panic` module)
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)
 - #67325 (cleanup with push_fake_read)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Dec 16, 2019
Rollup of 7 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #66735 (Add str::strip_prefix and str::strip_suffix)
 - #66771 (Stabilize the `core::panic` module)
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)
 - #67325 (cleanup with push_fake_read)

Failed merges:

r? @ghost
@SOF3 SOF3 requested a review from dtolnay December 16, 2019 13:37
@bors bors merged commit 6176051 into rust-lang:master Dec 16, 2019
@SOF3 SOF3 deleted the feature/str_strip branch December 17, 2019 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet