Repository: rust
Issue: Can you make "somestr".trim_matches(char::is_ascii_punctuation) compile too ? it compiles with char::is_numeric
Labels: C-enhancement,T-libs-api

this works:
```rust
assert_eq!("123foo1bar123".trim_matches(char::is_numeric), "foo1bar"); //ok
```
but this doesn't:
```rust
assert_eq!(
        ".,\"foo1bar\".,';".trim_matches(char::is_ascii_punctuation),
        "foo1bar"
    ); //XXX fail
    // expected signature of `fn(char) -> _`
    // found signature of `for<'r> fn(&'r char) -> _`
    //   = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `for<'r> fn(&'r char) -> bool {std::char::methods::<impl char>::is_ascii_punctuation}`
```

sig for [is_numeric](https://github.com/rust-lang/rust/blob/79d8a0fcefa5134db2a94739b1d18daa01fc6e9f/src/libcore/char/methods.rs#L737) is:
```rust
pub fn is_numeric(self) -> bool
```
And for [is_ascii_punctuation](https://github.com/rust-lang/rust/blob/79d8a0fcefa5134db2a94739b1d18daa01fc6e9f/src/libcore/char/methods.rs#L1276) is:
```rust
pub fn is_ascii_punctuation(&self) -> bool
```

So in order to make that work, I've had to do this:
```rust
pub trait Man {
    fn manual_is_ascii_punctuation(self) -> bool;
}

impl Man for char {
#[inline]
    fn manual_is_ascii_punctuation(self) -> bool {
        self.is_ascii() && (self as u8).is_ascii_punctuation()
    }
}
fn main() {
assert_eq!(
        ".,\"foo1bar\".,';".trim_matches(char::manual_is_ascii_punctuation),
        "foo1bar"
    ); //works because the func sig matches
}
```

Full code ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=755046954fcc672185f40cc2c1c0ff8a)):
```rust
#![allow(unused)]

pub trait Man {
    fn manual_is_ascii_punctuation(self) -> bool;
}

impl Man for char {
#[inline]
    fn manual_is_ascii_punctuation(self) -> bool {
        self.is_ascii() && (self as u8).is_ascii_punctuation()
    }
}

fn main() {
    assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar");
    assert_eq!("123foo1bar123".trim_matches(char::is_numeric), "foo1bar"); //ok
    assert_eq!(
        ".,\"foo1bar\".,';".trim_matches(char::manual_is_ascii_punctuation),
        "foo1bar"
    ); //works because the func sig matches
    assert_eq!(
        ".,\"foo1bar\".,';".trim_matches(char::is_ascii_punctuation),
        "foo1bar"
    ); //XXX fail
    // expected signature of `fn(char) -> _`
    // found signature of `for<'r> fn(&'r char) -> _`
    //   = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `for<'r> fn(&'r char) -> bool {std::char::methods::<impl char>::is_ascii_punctuation}`

    assert_eq!("\"123foo1bar\"".trim_matches(|x| x == '"'), "123foo1bar"); //ok

    let x: &[_] = &['1', '2'];
    assert_eq!("12foo1bar12".trim_matches(x), "foo1bar");
}

```

```rust
Compiling playground v0.0.1 (/playground)
error[E0631]: type mismatch in function arguments
  --> src/main.rs:22:29
   |
22 |         ".,\"foo1bar\".,';".trim_matches(char::is_ascii_punctuation),
   |                             ^^^^^^^^^^^^
   |                             |
   |                             expected signature of `fn(char) -> _`
   |                             found signature of `for<'r> fn(&'r char) -> _`
   |
   = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `for<'r> fn(&'r char) -> bool {std::char::methods::<impl char>::is_ascii_punctuation}`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0631`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.
```