Skip to content

Commit

Permalink
style: Use DoubleEndedIterator::next_back (#1255)
Browse files Browse the repository at this point in the history
Prevents clippy warnings like:
```
warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator
   --> prost-build/src/code_generator.rs:473:54
    |
473 |                         .and_then(|ty| ty.split('.').last())
    |                                                      ^^^^^^ help: try: `next_back()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last
    = note: `#[warn(clippy::double_ended_iterator_last)]` on by default
```
  • Loading branch information
caspermeijn authored Mar 8, 2025
1 parent 127cd6b commit 89806f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:

env:
PROTOC_VERSION: '3.25.3'
clippy_rust_version: '1.83'
clippy_rust_version: '1.85'

jobs:
# Depends on all actions that are required for a "successful" CI run.
Expand Down
2 changes: 1 addition & 1 deletion prost-build/src/code_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ impl<'b> CodeGenerator<'_, 'b> {
.descriptor
.type_name
.as_ref()
.and_then(|ty| ty.split('.').last())
.and_then(|ty| ty.split('.').next_back())
.unwrap();

enum_value = strip_enum_prefix(&to_upper_camel(enum_type), &enum_value)
Expand Down

0 comments on commit 89806f9

Please sign in to comment.