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

Open
wants to merge 3 commits into
base: master
from

Conversation

@SOF3
Copy link
Contributor

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

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Nov 25, 2019

r? @withoutboats

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

src/libcore/str/mod.rs Outdated Show resolved Hide resolved
src/libcore/str/mod.rs Outdated Show resolved Hide resolved
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Nov 26, 2019

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

This comment has been minimized.

Copy link
Member

Alexendoo commented Dec 4, 2019

Ping from triage, any updates? @withoutboats

@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Dec 4, 2019

r? @KodrAus

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

KodrAus left a comment

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 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.