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

attributes: extract match scrutinee #2880

Merged
merged 1 commit into from
Mar 12, 2024
Merged

Conversation

kaffarell
Copy link
Contributor

@kaffarell kaffarell commented Feb 14, 2024

On clippy version 1.76.0 this gives a warning, extracting the scrutinee to a variable fixes this.

Fixes: #2876

@kaffarell kaffarell requested review from hawkw and a team as code owners February 14, 2024 21:29
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, which warning does this generate?

In any case, looks good to me!

@kaffarell
Copy link
Contributor Author

kaffarell commented Feb 15, 2024

Huh, which warning does this generate?

This one: https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions (although the description here is a little bit out of date, it doesn't apply only to if's anymore fixed it)
The full clippy output is also in the issue linked :)

@seanpianka
Copy link

@kaffarell Can you rebase your changes with the latest trunk? This lint in your fork https://github.com/kaffarell/tracing/blob/v0.1.x/tracing-core/src/lib.rs#L138 is deprecated and has been replaced/updated on the trunk: https://github.com/tokio-rs/tracing/blob/master/tracing-core/src/lib.rs#L155.

This should make this PR ready to merge and ready to remove the 300+ warnings I have in one of my projects 😄

On clippy version 1.76.0 this gives a warning, extracting the
scrutinee to a variable fixes this.

Fixes: tokio-rs#2876
@kaffarell
Copy link
Contributor Author

@seanpianka rebased it ontop latest v0.1.x!

@seanpianka
Copy link

Thank you! @hawkw We should be good to go 🙂

@davidbarsky davidbarsky merged commit 36bf063 into tokio-rs:v0.1.x Mar 12, 2024
51 checks passed
kaffarell added a commit to kaffarell/tracing that referenced this pull request May 22, 2024
On clippy version 1.76.0 this gives a warning, extracting the
scrutinee to a variable fixes this.

Fixes: tokio-rs#2876
@kaffarell
Copy link
Contributor Author

@hawkw @davidbarsky could we release this? The lint is now in 1.80.1 stable clippy.

@davidbarsky
Copy link
Member

Sorry for the delay. I'll be doing a release for tracing and tracing-attributes today.

davidbarsky pushed a commit that referenced this pull request Oct 2, 2024
On clippy version 1.76.0 this gives a warning, extracting the
scrutinee to a variable fixes this.

Fixes: #2876
davidbarsky pushed a commit that referenced this pull request Oct 2, 2024
On clippy version 1.76.0 this gives a warning, extracting the
scrutinee to a variable fixes this.

Fixes: #2876
davidbarsky pushed a commit that referenced this pull request Oct 2, 2024
On clippy version 1.76.0 this gives a warning, extracting the
scrutinee to a variable fixes this.

Fixes: #2876
@hds hds mentioned this pull request Nov 19, 2024
20 tasks
hds added a commit that referenced this pull request Nov 25, 2024
# 0.1.28 (November 26, 2024)

### Changed

- Bump MSRV to 1.63 ([#2793])

### Fixed

- Added missing RecordTypes for instrument ([#2781])
- Change order of async and unsafe modifier ([#2864])
- Extract match scrutinee ([#2880])
- Allow field path segments to be keywords ([#2925])
- Support const values for `target` and `name` ([#2941])

### Documented

- Fix backporting error in attributes ([#2780])

[#2780]: #2780
[#2781]: #2781
[#2793]: #2793
[#2864]: #2864
[#2880]: #2880
[#2925]: #2925
[#2941]: #2941
hds added a commit that referenced this pull request Nov 26, 2024
# 0.1.28 (November 26, 2024)

### Changed

- Bump MSRV to 1.63 ([#2793])

### Fixed

- Added missing RecordTypes for instrument ([#2781])
- Change order of async and unsafe modifier ([#2864])
- Extract match scrutinee ([#2880])
- Allow field path segments to be keywords ([#2925])
- Support const values for `target` and `name` ([#2941])

### Documented

- Fix backporting error in attributes ([#2780])

[#2780]: #2780
[#2781]: #2781
[#2793]: #2793
[#2864]: #2864
[#2880]: #2880
[#2925]: #2925
[#2941]: #2941
hds added a commit that referenced this pull request Nov 27, 2024
# 0.1.41 (November 25, 2024)

[[[crates.io][crate-0.1.41]]] | [[[docs.rs][docs-0.1.41]]]

This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and
the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28].

### Added

- **core**: Add index API for `Field` ([#2820])
- **core**: Allow `&[u8]` to be recorded as event/span field ([#2954])

### Changed

- Bump MSRV to 1.63 ([#2793])
- **core**: Use const `thread_local`s when possible ([#2838])

### Fixed

- Removed core imports in macros ([#2762])
- **attributes**: Added missing RecordTypes for instrument ([#2781])
- **attributes**: Change order of async and unsafe modifier ([#2864])
- Fix missing field prefixes ([#2878])
- **attributes**: Extract match scrutinee ([#2880])
- Fix non-simple macro usage without message ([#2879])
- Fix event macros with constant field names in the first position ([#2883])
- Allow field path segments to be keywords ([#2925])
- **core**: Fix missed `register_callsite` error ([#2938])
- **attributes**: Support const values for `target` and `name` ([#2941])
- Prefix macro calls with ::core to avoid clashing with local macros ([#3024])

[#2762]: #2762
[#2781]: #2781
[#2793]: #2793
[#2820]: #2820
[#2838]: #2838
[#2864]: #2864
[#2878]: #2878
[#2879]: #2879
[#2880]: #2880
[#2883]: #2883
[#2925]: #2925
[#2938]: #2938
[#2941]: #2941
[#2954]: #2954
[#3024]: #3024
[attrs-0.1.28]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28
[core-0.1.33]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33
[docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/
[crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
hds added a commit that referenced this pull request Nov 27, 2024
# 0.1.41 (November 25, 2024)

[[[crates.io][crate-0.1.41]]] | [[[docs.rs][docs-0.1.41]]]

This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and
the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28].

### Added

- **core**: Add index API for `Field` ([#2820])
- **core**: Allow `&[u8]` to be recorded as event/span field ([#2954])

### Changed

- Bump MSRV to 1.63 ([#2793])
- **core**: Use const `thread_local`s when possible ([#2838])

### Fixed

- Removed core imports in macros ([#2762])
- **attributes**: Added missing RecordTypes for instrument ([#2781])
- **attributes**: Change order of async and unsafe modifier ([#2864])
- Fix missing field prefixes ([#2878])
- **attributes**: Extract match scrutinee ([#2880])
- Fix non-simple macro usage without message ([#2879])
- Fix event macros with constant field names in the first position ([#2883])
- Allow field path segments to be keywords ([#2925])
- **core**: Fix missed `register_callsite` error ([#2938])
- **attributes**: Support const values for `target` and `name` ([#2941])
- Prefix macro calls with ::core to avoid clashing with local macros ([#3024])

[#2762]: #2762
[#2781]: #2781
[#2793]: #2793
[#2820]: #2820
[#2838]: #2838
[#2864]: #2864
[#2878]: #2878
[#2879]: #2879
[#2880]: #2880
[#2883]: #2883
[#2925]: #2925
[#2938]: #2938
[#2941]: #2941
[#2954]: #2954
[#3024]: #3024
[attrs-0.1.28]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28
[core-0.1.33]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33
[docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/
[crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
hds added a commit that referenced this pull request Nov 27, 2024
# 0.1.41 (November 25, 2024)

[[[crates.io][crate-0.1.41]]] | [[[docs.rs][docs-0.1.41]]]

This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and
the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28].

### Added

- **core**: Add index API for `Field` ([#2820])
- **core**: Allow `&[u8]` to be recorded as event/span field ([#2954])

### Changed

- Bump MSRV to 1.63 ([#2793])
- **core**: Use const `thread_local`s when possible ([#2838])

### Fixed

- Removed core imports in macros ([#2762])
- **attributes**: Added missing RecordTypes for instrument ([#2781])
- **attributes**: Change order of async and unsafe modifier ([#2864])
- Fix missing field prefixes ([#2878])
- **attributes**: Extract match scrutinee ([#2880])
- Fix non-simple macro usage without message ([#2879])
- Fix event macros with constant field names in the first position ([#2883])
- Allow field path segments to be keywords ([#2925])
- **core**: Fix missed `register_callsite` error ([#2938])
- **attributes**: Support const values for `target` and `name` ([#2941])
- Prefix macro calls with ::core to avoid clashing with local macros ([#3024])

[#2762]: #2762
[#2781]: #2781
[#2793]: #2793
[#2820]: #2820
[#2838]: #2838
[#2864]: #2864
[#2878]: #2878
[#2879]: #2879
[#2880]: #2880
[#2883]: #2883
[#2925]: #2925
[#2938]: #2938
[#2941]: #2941
[#2954]: #2954
[#3024]: #3024
[attrs-0.1.28]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28
[core-0.1.33]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33
[docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/
[crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
hds added a commit that referenced this pull request Nov 27, 2024
# 0.1.41 (November 25, 2024)

[ [crates.io][crate-0.1.41] ] | [ [docs.rs][docs-0.1.41] ]

This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and
the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28].

### Added

- **core**: Add index API for `Field` ([#2820])
- **core**: Allow `&[u8]` to be recorded as event/span field ([#2954])

### Changed

- Bump MSRV to 1.63 ([#2793])
- **core**: Use const `thread_local`s when possible ([#2838])

### Fixed

- Removed core imports in macros ([#2762])
- **attributes**: Added missing RecordTypes for instrument ([#2781])
- **attributes**: Change order of async and unsafe modifier ([#2864])
- Fix missing field prefixes ([#2878])
- **attributes**: Extract match scrutinee ([#2880])
- Fix non-simple macro usage without message ([#2879])
- Fix event macros with constant field names in the first position ([#2883])
- Allow field path segments to be keywords ([#2925])
- **core**: Fix missed `register_callsite` error ([#2938])
- **attributes**: Support const values for `target` and `name` ([#2941])
- Prefix macro calls with ::core to avoid clashing with local macros ([#3024])

[#2762]: #2762
[#2781]: #2781
[#2793]: #2793
[#2820]: #2820
[#2838]: #2838
[#2864]: #2864
[#2878]: #2878
[#2879]: #2879
[#2880]: #2880
[#2883]: #2883
[#2925]: #2925
[#2938]: #2938
[#2941]: #2941
[#2954]: #2954
[#3024]: #3024
[attrs-0.1.28]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28
[core-0.1.33]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33
[docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/
[crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
hds added a commit that referenced this pull request Nov 27, 2024
# 0.1.41 (November 25, 2024)

[ [crates.io][crate-0.1.41] ] | [ [docs.rs][docs-0.1.41] ]

This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and
the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28].

### Added

- **core**: Add index API for `Field` ([#2820])
- **core**: Allow `&[u8]` to be recorded as event/span field ([#2954])

### Changed

- Bump MSRV to 1.63 ([#2793])
- **core**: Use const `thread_local`s when possible ([#2838])

### Fixed

- Removed core imports in macros ([#2762])
- **attributes**: Added missing RecordTypes for instrument ([#2781])
- **attributes**: Change order of async and unsafe modifier ([#2864])
- Fix missing field prefixes ([#2878])
- **attributes**: Extract match scrutinee ([#2880])
- Fix non-simple macro usage without message ([#2879])
- Fix event macros with constant field names in the first position ([#2883])
- Allow field path segments to be keywords ([#2925])
- **core**: Fix missed `register_callsite` error ([#2938])
- **attributes**: Support const values for `target` and `name` ([#2941])
- Prefix macro calls with ::core to avoid clashing with local macros ([#3024])

[#2762]: #2762
[#2781]: #2781
[#2793]: #2793
[#2820]: #2820
[#2838]: #2838
[#2864]: #2864
[#2878]: #2878
[#2879]: #2879
[#2880]: #2880
[#2883]: #2883
[#2925]: #2925
[#2938]: #2938
[#2941]: #2941
[#2954]: #2954
[#3024]: #3024
[attrs-0.1.28]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28
[core-0.1.33]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33
[docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/
[crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
hds added a commit that referenced this pull request Nov 27, 2024
# 0.1.41 (November 27, 2024)

[ [crates.io][crate-0.1.41] ] | [ [docs.rs][docs-0.1.41] ]

This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and
the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28].

### Added

- **core**: Add index API for `Field` ([#2820])
- **core**: Allow `&[u8]` to be recorded as event/span field ([#2954])

### Changed

- Bump MSRV to 1.63 ([#2793])
- **core**: Use const `thread_local`s when possible ([#2838])

### Fixed

- Removed core imports in macros ([#2762])
- **attributes**: Added missing RecordTypes for instrument ([#2781])
- **attributes**: Change order of async and unsafe modifier ([#2864])
- Fix missing field prefixes ([#2878])
- **attributes**: Extract match scrutinee ([#2880])
- Fix non-simple macro usage without message ([#2879])
- Fix event macros with constant field names in the first position ([#2883])
- Allow field path segments to be keywords ([#2925])
- **core**: Fix missed `register_callsite` error ([#2938])
- **attributes**: Support const values for `target` and `name` ([#2941])
- Prefix macro calls with ::core to avoid clashing with local macros ([#3024])

[#2762]: #2762
[#2781]: #2781
[#2793]: #2793
[#2820]: #2820
[#2838]: #2838
[#2864]: #2864
[#2878]: #2878
[#2879]: #2879
[#2880]: #2880
[#2883]: #2883
[#2925]: #2925
[#2938]: #2938
[#2941]: #2941
[#2954]: #2954
[#3024]: #3024
[attrs-0.1.28]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28
[core-0.1.33]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33
[docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/
[crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
hds added a commit that referenced this pull request Nov 27, 2024
# 0.1.41 (November 27, 2024)

[ [crates.io][crate-0.1.41] ] | [ [docs.rs][docs-0.1.41] ]

This release updates the `tracing-core` dependency to [v0.1.33][core-0.1.33] and
the `tracing-attributes` dependency to [v0.1.28][attrs-0.1.28].

### Added

- **core**: Add index API for `Field` ([#2820])
- **core**: Allow `&[u8]` to be recorded as event/span field ([#2954])

### Changed

- Bump MSRV to 1.63 ([#2793])
- **core**: Use const `thread_local`s when possible ([#2838])

### Fixed

- Removed core imports in macros ([#2762])
- **attributes**: Added missing RecordTypes for instrument ([#2781])
- **attributes**: Change order of async and unsafe modifier ([#2864])
- Fix missing field prefixes ([#2878])
- **attributes**: Extract match scrutinee ([#2880])
- Fix non-simple macro usage without message ([#2879])
- Fix event macros with constant field names in the first position ([#2883])
- Allow field path segments to be keywords ([#2925])
- **core**: Fix missed `register_callsite` error ([#2938])
- **attributes**: Support const values for `target` and `name` ([#2941])
- Prefix macro calls with ::core to avoid clashing with local macros ([#3024])

[#2762]: #2762
[#2781]: #2781
[#2793]: #2793
[#2820]: #2820
[#2838]: #2838
[#2864]: #2864
[#2878]: #2878
[#2879]: #2879
[#2880]: #2880
[#2883]: #2883
[#2925]: #2925
[#2938]: #2938
[#2941]: #2941
[#2954]: #2954
[#3024]: #3024
[attrs-0.1.28]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-attributes-0.1.28
[core-0.1.33]:
    https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.33
[docs-0.1.41]: https://docs.rs/tracing/0.1.41/tracing/
[crate-0.1.41]: https://crates.io/crates/tracing/0.1.41
mrozycki added a commit to mrozycki/tracing that referenced this pull request Dec 4, 2024
A large match scrutinee was causing clippy warnings. PR tokio-rs#2880
fixed this for the case where both err and ret are present,
but the exact same issue occurs with just err present, and that
has not been fixed.

This pull request applies the same fix to the err-only case.
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.

4 participants