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

Set all crates to 2021 edition #580

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ jobs:
rustup update stable --no-self-update
rustup default stable
rustup component add rustfmt
# log repo does not use Cargo workspaces, so `cargo fmt` will not check all the code
# perhaps this should be changed in the future
- run: cargo fmt -- --check
nyurik marked this conversation as resolved.
Show resolved Hide resolved
- run: cargo fmt --manifest-path test_max_level_features/Cargo.toml -- --check
- run: cargo fmt --manifest-path tests/Cargo.toml -- --check

clippy:
name: Clippy
Expand All @@ -74,6 +78,8 @@ jobs:
rustup default stable
rustup component add clippy
- run: cargo clippy --verbose
- run: cargo clippy --verbose --manifest-path test_max_level_features/Cargo.toml
- run: cargo clippy --verbose --manifest-path tests/Cargo.toml

doc:
name: Check Documentation
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ categories = ["development-tools::debugging"]
keywords = ["logging"]
exclude = ["rfcs/**/*"]
rust-version = "1.60.0"
edition = "2021"

[package.metadata.docs.rs]
features = ["std", "serde", "kv_unstable_std", "kv_unstable_sval", "kv_unstable_serde"]
Expand Down
3 changes: 0 additions & 3 deletions benches/value.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#![cfg(feature = "kv_unstable")]
#![feature(test)]

extern crate log;
extern crate test;

use log::kv::Value;

#[bench]
Expand Down
2 changes: 1 addition & 1 deletion rfcs/0296-structured-logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ Some useful adapters exist as provided methods on the `Source` trait. They're si

- `by_ref` to get a reference to a `Source` within a method chain.
- `chain` to concatenate one source with another. This is useful for composing implementations of `Log` together for contextual logging.
- `get` to try find the value associated with a key. This is useful for well-defined key-value pairs that a framework built over `log` might want to provide, like timestamps or message templates.
- `get` to try finding the value associated with a key. This is useful for well-defined key-value pairs that a framework built over `log` might want to provide, like timestamps or message templates.
- `for_each` to execute some closure over all key-value pairs. This is a convenient way to do something with each key-value pair without having to create and implement a `Visitor`. One potential downside of `for_each` is the `Result` return value, which seems surprising when the closure itself can't fail. The `Source::for_each` call might itself fail if the underlying `visit` call fails when iterating over its key-value pairs. This shouldn't be common though, so when paired with `try_for_each`, it might be reasonable to make `for_each` return a `()` and rely on `try_for_each` for surfacing any fallibility.
- `try_for_each` is like `for_each`, but takes a fallible closure.
- `as_map` to get a serializable map. This is a convenient way to serialize key-value pairs without having to create and implement a `Visitor`.
Expand Down
16 changes: 4 additions & 12 deletions src/kv/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,8 @@ mod std_support {
mod sval_support {
use super::*;

extern crate sval;
extern crate sval_ref;

use self::sval::Value;
use self::sval_ref::ValueRef;
use sval::Value;
use sval_ref::ValueRef;

impl<'a> Value for Key<'a> {
fn stream<'sval, S: sval::Stream<'sval> + ?Sized>(
Expand All @@ -119,10 +116,7 @@ mod sval_support {
}

impl<'a> ValueRef<'a> for Key<'a> {
fn stream_ref<S: self::sval::Stream<'a> + ?Sized>(
&self,
stream: &mut S,
) -> self::sval::Result {
fn stream_ref<S: sval::Stream<'a> + ?Sized>(&self, stream: &mut S) -> sval::Result {
self.key.stream(stream)
}
}
Expand All @@ -132,9 +126,7 @@ mod sval_support {
mod serde_support {
use super::*;

extern crate serde;

use self::serde::{Serialize, Serializer};
use serde::{Serialize, Serializer};

impl<'a> Serialize for Key<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
Expand Down
Loading