Skip to content
Open
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
28 changes: 13 additions & 15 deletions tracing-attributes/tests/ui/async_instrument.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ error[E0308]: mismatched types
--> tests/ui/async_instrument.rs:10:5
|
10 | ""
| ^^- help: try using a conversion method: `.to_string()`
| |
| expected `String`, found `&str`
| ^^ expected `String`, found `&str`
|
note: return type inferred to be `String` here
--> tests/ui/async_instrument.rs:9:31
|
9 | async fn simple_mismatch() -> String {
9 | async fn simple_mismatch() -> String {
| ^^^^^^
help: try using a conversion method
|
10 | "".to_string()
| ++++++++++++

error[E0277]: `(&str,)` doesn't implement `std::fmt::Display`
--> tests/ui/async_instrument.rs:14:57
Expand All @@ -33,20 +35,14 @@ error[E0277]: `(&str,)` doesn't implement `std::fmt::Display`
16 | | }
| | ^
| | |
| |_`(&str,)` cannot be formatted with the default formatter
| |_the trait `std::fmt::Display` is not implemented for `(&str,)`
| return type was inferred to be `(&str,)` here
|
= help: the trait `std::fmt::Display` is not implemented for `(&str,)`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead

error[E0277]: `(&str,)` doesn't implement `std::fmt::Display`
--> tests/ui/async_instrument.rs:14:34
|
14 | async fn opaque_unsatisfied() -> impl std::fmt::Display {
| ^^^^^^^^^^^^^^^^^^^^^^ `(&str,)` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `(&str,)`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::fmt::Display` is not implemented for `(&str,)`

error[E0308]: mismatched types
--> tests/ui/async_instrument.rs:22:5
Expand Down Expand Up @@ -82,15 +78,17 @@ error[E0308]: mismatched types
--> tests/ui/async_instrument.rs:35:16
|
35 | return "";
| ^^- help: try using a conversion method: `.to_string()`
| |
| expected `String`, found `&str`
| ^^ expected `String`, found `&str`
|
note: return type inferred to be `String` here
--> tests/ui/async_instrument.rs:33:28
|
33 | async fn early_return() -> String {
| ^^^^^^
help: try using a conversion method
|
35 | return "".to_string();
| ++++++++++++

error[E0308]: mismatched types
--> tests/ui/async_instrument.rs:40:1
Expand Down
4 changes: 2 additions & 2 deletions tracing-core/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ mod test {

struct MyVisitor;
impl Visit for MyVisitor {
fn record_debug(&mut self, field: &Field, _: &dyn (core::fmt::Debug)) {
fn record_debug(&mut self, field: &Field, _: &dyn core::fmt::Debug) {
assert_eq!(field.callsite(), TEST_META_1.callsite())
}
}
Expand All @@ -1133,7 +1133,7 @@ mod test {

struct MyVisitor;
impl Visit for MyVisitor {
fn record_debug(&mut self, field: &Field, _: &dyn (core::fmt::Debug)) {
fn record_debug(&mut self, field: &Field, _: &dyn core::fmt::Debug) {
assert_eq!(field.name(), "bar")
}
}
Expand Down
46 changes: 23 additions & 23 deletions tracing-mock/tests/span_ancestry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn contextual_parent() {

with_default(collector, || {
let _guard = tracing::info_span!("contextual parent").entered();
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -45,7 +45,7 @@ fn contextual_parent_wrong_name() {

with_default(collector, || {
let _guard = tracing::info_span!("another parent").entered();
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -70,7 +70,7 @@ fn contextual_parent_wrong_id() {
with_default(collector, || {
let _span = tracing::info_span!("contextual parent");
let _guard = tracing::info_span!("another parent").entered();
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -94,7 +94,7 @@ fn contextual_parent_wrong_level() {

with_default(collector, || {
let _guard = tracing::debug_span!("contextual parent").entered();
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -111,7 +111,7 @@ fn expect_contextual_parent_actual_contextual_root() {
let (collector, handle) = collector::mock().new_span(span).run_with_handle();

with_default(collector, || {
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -132,7 +132,7 @@ fn expect_contextual_parent_actual_explicit_parent() {

with_default(collector, || {
let span = tracing::info_span!("explicit parent");
tracing::info_span!(parent: span.id(), "span");
let _ = tracing::info_span!(parent: span.id(), "span");
});

handle.assert_finished();
Expand All @@ -153,7 +153,7 @@ fn expect_contextual_parent_actual_explicit_root() {

with_default(collector, || {
let _guard = tracing::info_span!("contextual parent").entered();
tracing::info_span!(parent: None, "span");
let _ = tracing::info_span!(parent: None, "span");
});

handle.assert_finished();
Expand All @@ -168,7 +168,7 @@ fn contextual_root() {
let (collector, handle) = collector::mock().new_span(span).run_with_handle();

with_default(collector, || {
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -188,7 +188,7 @@ fn expect_contextual_root_actual_contextual_parent() {

with_default(collector, || {
let _guard = tracing::info_span!("contextual parent").entered();
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -208,7 +208,7 @@ fn expect_contextual_root_actual_explicit_parent() {

with_default(collector, || {
let span = tracing::info_span!("explicit parent");
tracing::info_span!(parent: span.id(), "span");
let _ = tracing::info_span!(parent: span.id(), "span");
});

handle.assert_finished();
Expand All @@ -228,7 +228,7 @@ fn expect_contextual_root_actual_explicit_root() {

with_default(collector, || {
let _guard = tracing::info_span!("contextual parent").entered();
tracing::info_span!(parent: None, "span");
let _ = tracing::info_span!(parent: None, "span");
});

handle.assert_finished();
Expand All @@ -247,7 +247,7 @@ fn explicit_parent() {

with_default(collector, || {
let span = tracing::info_span!("explicit parent");
tracing::info_span!(parent: span.id(), "span");
let _ = tracing::info_span!(parent: span.id(), "span");
});

handle.assert_finished();
Expand All @@ -270,7 +270,7 @@ fn explicit_parent_wrong_name() {

with_default(collector, || {
let span = tracing::info_span!("another parent");
tracing::info_span!(parent: span.id(), "span");
let _ = tracing::info_span!(parent: span.id(), "span");
});

handle.assert_finished();
Expand All @@ -294,7 +294,7 @@ fn explicit_parent_wrong_id() {
with_default(collector, || {
let _span = tracing::info_span!("explicit parent");
let another_span = tracing::info_span!("another parent");
tracing::info_span!(parent: another_span.id(), "span");
let _ = tracing::info_span!(parent: another_span.id(), "span");
});

handle.assert_finished();
Expand All @@ -316,7 +316,7 @@ fn explicit_parent_wrong_level() {

with_default(collector, || {
let span = tracing::debug_span!("explicit parent");
tracing::info_span!(parent: span.id(), "span");
let _ = tracing::info_span!(parent: span.id(), "span");
});

handle.assert_finished();
Expand All @@ -337,7 +337,7 @@ fn expect_explicit_parent_actual_contextual_parent() {

with_default(collector, || {
let _guard = tracing::info_span!("contextual parent").entered();
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -354,7 +354,7 @@ fn expect_explicit_parent_actual_contextual_root() {
let (collector, handle) = collector::mock().new_span(span).run_with_handle();

with_default(collector, || {
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -375,7 +375,7 @@ fn expect_explicit_parent_actual_explicit_root() {

with_default(collector, || {
let _guard = tracing::info_span!("contextual parent").entered();
tracing::info_span!(parent: None, "span");
let _ = tracing::info_span!(parent: None, "span");
});

handle.assert_finished();
Expand All @@ -395,7 +395,7 @@ fn explicit_root() {

with_default(collector, || {
let _guard = tracing::info_span!("contextual parent").entered();
tracing::info_span!(parent: None, "span");
let _ = tracing::info_span!(parent: None, "span");
});

handle.assert_finished();
Expand All @@ -415,7 +415,7 @@ fn expect_explicit_root_actual_contextual_parent() {

with_default(collector, || {
let _guard = tracing::info_span!("contextual parent").entered();
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -431,7 +431,7 @@ fn expect_explicit_root_actual_contextual_root() {
let (collector, handle) = collector::mock().new_span(span).run_with_handle();

with_default(collector, || {
tracing::info_span!("span");
let _ = tracing::info_span!("span");
});

handle.assert_finished();
Expand All @@ -451,7 +451,7 @@ fn expect_explicit_root_actual_explicit_parent() {

with_default(collector, || {
let span = tracing::info_span!("explicit parent");
tracing::info_span!(parent: span.id(), "span");
let _ = tracing::info_span!(parent: span.id(), "span");
});

handle.assert_finished();
Expand All @@ -466,7 +466,7 @@ fn explicit_and_contextual_root_is_explicit() {
let (collector, handle) = collector::mock().new_span(span).run_with_handle();

with_default(collector, || {
tracing::info_span!(parent: None, "span");
let _ = tracing::info_span!(parent: None, "span");
});

handle.assert_finished();
Expand Down
18 changes: 9 additions & 9 deletions tracing-subscriber/tests/env_filter/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ fn same_name_spans() {
.run_with_handle();
let subscriber = subscriber.with(filter);
with_default(subscriber, || {
tracing::trace_span!("foo", bar = 1);
tracing::trace_span!("foo", baz = 1);
let _ = tracing::trace_span!("foo", bar = 1);
let _ = tracing::trace_span!("foo", baz = 1);
});

finished.assert_finished();
Expand Down Expand Up @@ -343,9 +343,9 @@ fn more_specific_dynamic_filter_more_verbose() {
let subscriber = collector.with(filter);

with_default(subscriber, || {
tracing::info_span!("enabled info");
tracing::debug_span!("disabled debug");
tracing::debug_span!("enabled debug", hello = &4_u64);
let _ = tracing::info_span!("enabled info");
let _ = tracing::debug_span!("disabled debug");
let _ = tracing::debug_span!("enabled debug", hello = &4_u64);

// .only() doesn't work when we don't enter/exit spans
tracing::info!("marker");
Expand Down Expand Up @@ -391,10 +391,10 @@ fn more_specific_dynamic_filter_less_verbose() {
let subscriber = collector.with(filter);

with_default(subscriber, || {
tracing::info_span!("enabled info");
tracing::warn_span!("enabled hello=100 warn", hello = &100_u64);
tracing::info_span!("disabled hello=4 info", hello = &4_u64);
tracing::warn_span!("enabled hello=4 warn", hello = &4_u64);
let _ = tracing::info_span!("enabled info");
let _ = tracing::warn_span!("enabled hello=100 warn", hello = &100_u64);
let _ = tracing::info_span!("disabled hello=4 info", hello = &4_u64);
let _ = tracing::warn_span!("enabled hello=4 warn", hello = &4_u64);

// .only() doesn't work when we don't enter/exit spans
tracing::info!("marker");
Expand Down
4 changes: 2 additions & 2 deletions tracing-subscriber/tests/env_filter/per_subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ fn same_name_spans() {
.with(subscriber.with_filter(filter))
.set_default();

tracing::trace_span!("foo", bar = 1);
tracing::trace_span!("foo", baz = 1);
let _ = tracing::trace_span!("foo", bar = 1);
let _ = tracing::trace_span!("foo", baz = 1);

handle.assert_finished();
}
Expand Down
4 changes: 2 additions & 2 deletions tracing-subscriber/tests/same_len_filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ fn same_num_fields_and_name_len() {
.run_with_handle();
let subscriber = subscriber.with(filter);
with_default(subscriber, || {
tracing::trace_span!("foo", bar = 1);
tracing::trace_span!("baz", boz = 1);
let _ = tracing::trace_span!("foo", bar = 1);
let _ = tracing::trace_span!("baz", boz = 1);
});

finished.assert_finished();
Expand Down
6 changes: 3 additions & 3 deletions tracing-subscriber/tests/subscriber_filters/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ fn basic_subscriber_filters_spans() {
.with(info_subscriber.with_filter(LevelFilter::INFO))
.set_default();

tracing::trace_span!("hello trace");
tracing::debug_span!("hello debug");
tracing::info_span!("hello info");
let _ = tracing::trace_span!("hello trace");
let _ = tracing::debug_span!("hello debug");
let _ = tracing::info_span!("hello info");

trace_handle.assert_finished();
debug_handle.assert_finished();
Expand Down
1 change: 1 addition & 0 deletions tracing/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ pub trait AsId: crate::sealed::Sealed {
/// span will silently do nothing. Thus, the handle can be used in the same
/// manner regardless of whether or not the trace is currently being collected.
#[derive(Clone)]
#[must_use = "Once a span has been created, it should be entered."]
pub struct Span {
/// A handle used to enter the span when it is not executing.
///
Expand Down
Loading