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

Simplify use of endswith #75

Merged
merged 1 commit into from
Apr 18, 2022
Merged

Simplify use of endswith #75

merged 1 commit into from
Apr 18, 2022

Conversation

mgeisler
Copy link
Owner

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Mar 20, 2022

Codecov Report

Merging #75 (72c48a1) into master (fbcf857) will decrease coverage by 0.60%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #75      +/-   ##
==========================================
- Coverage   96.36%   95.75%   -0.61%     
==========================================
  Files           2        2              
  Lines         165      165              
==========================================
- Hits          159      158       -1     
- Misses          6        7       +1     
Impacted Files Coverage Δ
src/lib.rs 95.59% <100.00%> (-0.63%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fbcf857...72c48a1. Read the comment docs.

@mgeisler mgeisler enabled auto-merge April 18, 2022 15:51
@mgeisler mgeisler merged commit 7eea1a4 into master Apr 18, 2022
@mgeisler mgeisler deleted the simplify-ends-with branch April 18, 2022 15:52
mgeisler added a commit that referenced this pull request Jun 6, 2022
Something changed between Rust 1.57 and 1.58 so that the slice pattern
doesn’t work without an explicit type annotation in the earlier
version. Without it, we get

```
error[E0277]: expected a `Fn<(char,)>` closure, found `[char; 3]`
   --> src/lib.rs:350:52
    |
350 |             let mut needs_cap = sentence.ends_with(punctuation);
    |                                                    ^^^^^^^^^^^ expected an `Fn<(char,)>` closure, found `[char; 3]`
    |
    = help: the trait `Fn<(char,)>` is not implemented for `[char; 3]`
    = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&[char; 3]`
    = note: required because of the requirements on the impl of `Pattern<'_>` for `&[char; 3]`
```

Between 1.57 and 1.58, the `Pattern` trait got a new implementation
for `[char; N]`, and I guess this somehow made the code work
afterwards (even though we’re using a `[char]` here).

The problematic code change was introduced in #75.

Fixes #83.
mgeisler added a commit that referenced this pull request Jun 6, 2022
Something changed between Rust 1.57 and 1.58 so that the slice pattern
doesn’t work without an explicit type annotation in the earlier
version. Without it, we get

```
error[E0277]: expected a `Fn<(char,)>` closure, found `[char; 3]`
   --> src/lib.rs:350:52
    |
350 |             let mut needs_cap = sentence.ends_with(punctuation);
    |                                                    ^^^^^^^^^^^ expected an `Fn<(char,)>` closure, found `[char; 3]`
    |
    = help: the trait `Fn<(char,)>` is not implemented for `[char; 3]`
    = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&[char; 3]`
    = note: required because of the requirements on the impl of `Pattern<'_>` for `&[char; 3]`
```

Between 1.57 and 1.58, the `Pattern` trait got a new implementation
for `[char; N]`, and I guess this somehow made the code work
afterwards (even though we’re using a `[char]` here).

The problematic code change was introduced in #75.

Fixes #83.
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.

2 participants