Skip to content
/ rustc Public
forked from rust-lang/rust

Commit

Permalink
Rollup merge of rust-lang#72466 - lzutao:stabilize_str-strip, r=dtolnay
Browse files Browse the repository at this point in the history
Stabilize str_strip feature

This PR stabilizes these APIs:

```rust
impl str {
    /// Returns a string slice with the prefix removed.
    ///
    /// If the string starts with the pattern `prefix`, `Some` is returned with the substring where
    /// the prefix is removed. Unlike `trim_start_matches`, this method removes the prefix exactly
    /// once.
    pub fn strip_prefix<'a, P: Pattern<'a>>(&'a self, prefix: P) -> Option<&'a str>;

    /// Returns a string slice with the suffix removed.
    ///
    /// If the string ends with the pattern `suffix`, `Some` is returned with the substring where
    /// the suffix is removed. Unlike `trim_end_matches`, this method removes the suffix exactly
    /// once.
    pub fn strip_suffix<'a, P>(&'a self, suffix: P) -> Option<&'a str>
    where
        P: Pattern<'a>,
        <P as Pattern<'a>>::Searcher: ReverseSearcher<'a>;
}
```

Closes  rust-lang#67302
  • Loading branch information
Dylan-DPC authored May 29, 2020
2 parents e820a03 + 221c482 commit 28c690e
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/driver.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![feature(rustc_private)]
#![feature(str_strip)]

// FIXME: switch to something more ergonomic here, once available.
// (Currently there is no way to opt into sysroot crates without `extern crate`.)
Expand Down

0 comments on commit 28c690e

Please sign in to comment.