mirror of
https://gitee.com/openharmony/third_party_rust_log
synced 2024-11-22 23:29:49 +00:00
run fmt
This commit is contained in:
parent
d6e44eb253
commit
7ed6401b93
@ -40,34 +40,44 @@ impl<'v> ToValue for Value<'v> {
|
||||
/// Get a value from a type implementing `std::fmt::Debug`.
|
||||
#[macro_export]
|
||||
macro_rules! as_debug {
|
||||
($capture:expr) => ($crate::kv::Value::from_debug(&$capture));
|
||||
($capture:expr) => {
|
||||
$crate::kv::Value::from_debug(&$capture)
|
||||
};
|
||||
}
|
||||
|
||||
/// Get a value from a type implementing `std::fmt::Display`.
|
||||
#[macro_export]
|
||||
macro_rules! as_display {
|
||||
($capture:expr) => ($crate::kv::Value::from_display(&$capture));
|
||||
($capture:expr) => {
|
||||
$crate::kv::Value::from_display(&$capture)
|
||||
};
|
||||
}
|
||||
|
||||
/// Get a value from an error.
|
||||
#[cfg(feature = "kv_unstable_std")]
|
||||
#[macro_export]
|
||||
macro_rules! as_error {
|
||||
($capture:expr) => ($crate::kv::Value::from_dyn_error(&$capture));
|
||||
($capture:expr) => {
|
||||
$crate::kv::Value::from_dyn_error(&$capture)
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "kv_unstable_serde")]
|
||||
/// Get a value from a type implementing `serde::Serialize`.
|
||||
#[macro_export]
|
||||
macro_rules! as_serde {
|
||||
($capture:expr) => ($crate::kv::Value::from_serde(&$capture));
|
||||
($capture:expr) => {
|
||||
$crate::kv::Value::from_serde(&$capture)
|
||||
};
|
||||
}
|
||||
|
||||
/// Get a value from a type implementing `sval::value::Value`.
|
||||
#[cfg(feature = "kv_unstable_sval")]
|
||||
#[macro_export]
|
||||
macro_rules! as_sval {
|
||||
($capture:expr) => ($crate::kv::Value::from_sval(&$capture));
|
||||
($capture:expr) => {
|
||||
$crate::kv::Value::from_sval(&$capture)
|
||||
};
|
||||
}
|
||||
|
||||
/// A value in a structured key-value pair.
|
||||
|
@ -190,27 +190,27 @@ mod implicit_args {
|
||||
#[test]
|
||||
fn implicit_named_args() {
|
||||
let world = "world";
|
||||
|
||||
|
||||
for lvl in log::Level::iter() {
|
||||
log!(lvl, "hello {world}");
|
||||
log!(lvl, "hello {world}",);
|
||||
|
||||
|
||||
log!(target: "my_target", lvl, "hello {world}");
|
||||
log!(target: "my_target", lvl, "hello {world}",);
|
||||
|
||||
|
||||
log!(lvl; "hello {world}");
|
||||
log!(lvl; "hello {world}",);
|
||||
|
||||
|
||||
log!(target = "my_target", lvl; "hello {world}");
|
||||
log!(target = "my_target", lvl; "hello {world}",);
|
||||
}
|
||||
|
||||
|
||||
all_log_macros!("hello {world}");
|
||||
all_log_macros!("hello {world}",);
|
||||
|
||||
|
||||
all_log_macros!(target = "my_target"; "hello {world}");
|
||||
all_log_macros!(target = "my_target"; "hello {world}",);
|
||||
|
||||
|
||||
all_log_macros!(target: "my_target", "hello {world}");
|
||||
all_log_macros!(target: "my_target", "hello {world}",);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user