Skip to content

Commit

Permalink
fix: lint issues in 1.52.0 (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyCpp committed May 9, 2021
1 parent 92a0d85 commit f74705c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.46.0
toolchain: 1.49.0
override: true
- name: Run tests
run: cargo --version &&
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ above, please let us know! We'd love to add your project to the list!
## Supported Rust Versions

OpenTelemetry is built against the latest stable release. The minimum supported
version is 1.46. The current OpenTelemetry version is not guaranteed to build
version is 1.49. The current OpenTelemetry version is not guaranteed to build
on Rust versions earlier than the minimum supported version.

The current stable Rust compiler and the three most recent minor versions
Expand Down
9 changes: 6 additions & 3 deletions opentelemetry-datadog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,15 @@ mod propagator {
}

fn extract_trace_id(&self, trace_id: &str) -> Result<TraceId, ExtractError> {
u64::from_str_radix(trace_id, 10)
trace_id
.parse::<u64>()
.map(|id| TraceId::from_u128(id as u128))
.map_err(|_| ExtractError::TraceId)
}

fn extract_span_id(&self, span_id: &str) -> Result<SpanId, ExtractError> {
u64::from_str_radix(span_id, 10)
span_id
.parse::<u64>()
.map(SpanId::from_u64)
.map_err(|_| ExtractError::SpanId)
}
Expand All @@ -214,7 +216,8 @@ mod propagator {
&self,
sampling_priority: &str,
) -> Result<SamplingPriority, ExtractError> {
let i = i32::from_str_radix(sampling_priority, 10)
let i = sampling_priority
.parse::<i32>()
.map_err(|_| ExtractError::SamplingPriority)?;

match i {
Expand Down
19 changes: 9 additions & 10 deletions opentelemetry-otlp/tests/grpc_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,17 @@ fn build_grpc() {
}

fn build_content_map() -> HashMap<PathBuf, String> {
let mut map = HashMap::new();
let dict =
std::fs::read_dir("src/proto/grpcio").expect("cannot open dict of generated grpc files");
for entry in dict {
if let Ok(entry) = entry {
map.insert(
std::fs::read_dir("src/proto/grpcio")
.expect("cannot open dict of generated grpc files")
.into_iter()
.flatten()
.map(|entry| {
(
entry.path(),
std::fs::read_to_string(entry.path()).unwrap_or_else(|_| {
panic!("cannot read from file {}", entry.path().to_string_lossy())
}),
);
}
}
map
)
})
.collect()
}

0 comments on commit f74705c

Please sign in to comment.