Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lint issues in 1.52.0 #543

Merged
merged 4 commits into from May 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
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
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
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
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| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant you could collect into map directly by yielding (entry.path(), std::fs::read_to_string()) items.

(
entry.path(),
std::fs::read_to_string(entry.path()).unwrap_or_else(|_| {
panic!("cannot read from file {}", entry.path().to_string_lossy())
}),
);
}
}
map
)
})
.collect()
}