Skip to content

Commit

Permalink
Add warning about assigning the uninstaller to '_'
Browse files Browse the repository at this point in the history
It is common rust convention to use _ to signify an unused variable. Because we _are_ using this (until the end of the block) it is helpful to explain the intent.
  • Loading branch information
arlyon committed Dec 1, 2020
1 parent 6249046 commit 283e0b5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ use opentelemetry::{exporter::trace::stdout, trace::Tracer};

fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
// Create a new instrumentation pipeline
// Note: uninstalling the tracer happens when the _uninstall
// variable is dropped. Assigning it to _ will immediately
// drop it and uninstall the tracer
let (tracer, _uninstall) = stdout::new_pipeline().install();

tracer.in_span("doing_work", |cx| {
Expand Down

0 comments on commit 283e0b5

Please sign in to comment.