heroku / libcnb.rs

A framework for writing Cloud Native Buildpacks in Rust
BSD 3-Clause "New" or "Revised" License
34 stars 6 forks source link

Fix compile warnings when `trace` feature is disabled #766

Closed Malax closed 7 months ago

Malax commented 7 months ago

When the trace feature is disabled, several warnings will be emitted during compilation. These warnings started to appear after #723 was merged.

warning: unused variable: `err`
   --> libcnb/src/runtime.rs:135:28
    |
135 |     let mut trace_error = |err: &dyn std::error::Error| {
    |                            ^^^ help: if this is intentional, prefix it with an underscore: `_err`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: variable does not need to be mutable
   --> libcnb/src/runtime.rs:135:9
    |
135 |     let mut trace_error = |err: &dyn std::error::Error| {
    |         ----^^^^^^^^^^^
    |         |
    |         help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

warning: unused variable: `err`
   --> libcnb/src/runtime.rs:209:28
    |
209 |     let mut trace_error = |err: &dyn std::error::Error| {
    |                            ^^^ help: if this is intentional, prefix it with an underscore: `_err`

warning: variable does not need to be mutable
   --> libcnb/src/runtime.rs:209:9
    |
209 |     let mut trace_error = |err: &dyn std::error::Error| {
    |         ----^^^^^^^^^^^
    |         |
    |         help: remove this `mut`

warning: `libcnb` (lib) generated 4 warnings (run `cargo fix --lib -p libcnb` to apply 4 suggestions)

This PR fixes those.