From f62d2d2277ff441fd03262166c0819ea3ed50b38 Mon Sep 17 00:00:00 2001 From: Marco Neumann Date: Tue, 12 Oct 2021 16:36:06 +0200 Subject: [PATCH] refactor: `Vec::with_capacity(0)` => `vec![]` `vec![]` also results in a capacity of 0, see https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=184113a9afa945cf3cf3b8f854f4c5ce --- trace/src/ctx.rs | 4 ++-- trace_http/src/ctx.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/trace/src/ctx.rs b/trace/src/ctx.rs index e3cb155aac..fad4cc844a 100644 --- a/trace/src/ctx.rs +++ b/trace/src/ctx.rs @@ -72,7 +72,7 @@ impl SpanContext { trace_id: TraceId(NonZeroU128::new(trace_id).unwrap()), parent_span_id: None, span_id: SpanId(NonZeroU64::new(span_id).unwrap()), - links: Vec::with_capacity(0), + links: vec![], collector: Some(collector), } } @@ -85,7 +85,7 @@ impl SpanContext { trace_id: self.trace_id, span_id: SpanId::gen(), collector: self.collector.clone(), - links: Vec::with_capacity(0), + links: vec![], parent_span_id: Some(self.span_id), }, start: None, diff --git a/trace_http/src/ctx.rs b/trace_http/src/ctx.rs index 67c27d1bec..3e609b621b 100644 --- a/trace_http/src/ctx.rs +++ b/trace_http/src/ctx.rs @@ -155,7 +155,7 @@ fn decode_b3( } // Links cannot be specified via the HTTP header - let links = Vec::with_capacity(0); + let links = vec![]; Ok(Some(SpanContext { trace_id: required_header(headers, B3_TRACE_ID_HEADER, parse_trace)?, @@ -216,7 +216,7 @@ fn decode_jaeger( } // Links cannot be specified via the HTTP header - let links = Vec::with_capacity(0); + let links = vec![]; Ok(Some(SpanContext { trace_id: decoded.trace_id,