-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Motivation This makes both structs easier to use because you no longer have to worry about borrow errors while working with them. There's no downside to making them `Copy` since both are wrappers around a `usize`. Usually, we try to avoid adding `Copy` implementations for public API types, as it presents a forward-compatibility hazard in the event that the internal representation of those types must change to one that is no longer trivially copyable. However, in this case, we rely on `Level` and `LevelFilter` having a `usize` representation (and there's a test asserting that `LevelFilter`s can be transmuted to `usize`). Any change to the internal representation would already be breaking, so it's okay to commit to `Copy` here. Ideally, this would make `Metadata::level` return `Level` instead of `&Level`. However that's a breaking change, so I didn't make it here. ## Solution Derive `Copy` for both structs and fix various warnings that popped up as a result. Since this changes crates that depend on tracing-core to remove clone calls and rely on Level and LevelFilter being Copy, those crates will no longer compile with older versions of tracing-core. This bumps the version number for `tracing-core` and sets the minimum version to the new version for all affected crates. This avoids compile errors with a cached `Cargo.lock`.
- Loading branch information
Showing
12 changed files
with
31 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters