Skip to content

Commit

Permalink
add feature gate to prevent unused warning
Browse files Browse the repository at this point in the history
  • Loading branch information
stevefan1999-personal committed Oct 28, 2024
1 parent cabb7e8 commit e76ac0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/build/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use alloc::string::{String, ToString};
use alloc::string::String;
#[cfg(feature = "keep-error-msg")]
use alloc::string::ToString;
use core::{fmt, result};
#[cfg(feature = "std")]
use std::error;
Expand All @@ -11,6 +13,7 @@ pub struct Error(#[cfg(feature = "keep-error-msg")] pub(crate) String);

impl Error {
#[inline(always)]
#[allow(dead_code)]
pub(super) fn new(#[allow(unused_variables)] message: impl Into<String>) -> Self {
Self(
#[cfg(feature = "keep-error-msg")]
Expand Down Expand Up @@ -39,7 +42,7 @@ impl fmt::Display for Error {
impl error::Error for Error {}

impl From<read::Error> for Error {
fn from(error: read::Error) -> Error {
fn from(#[allow(unused_variables)] error: read::Error) -> Error {
Error(
#[cfg(feature = "keep-error-msg")]
error.0.to_string(),
Expand All @@ -48,7 +51,7 @@ impl From<read::Error> for Error {
}

impl From<write::Error> for Error {
fn from(error: write::Error) -> Error {
fn from(#[allow(unused_variables)] error: write::Error) -> Error {
Error(
#[cfg(feature = "keep-error-msg")]
error.0,
Expand Down
1 change: 1 addition & 0 deletions src/write/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//! and [PE](pe::Writer).
use alloc::borrow::Cow;
#[cfg(feature = "keep-error-msg")]
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::{fmt, result, str};
Expand Down

0 comments on commit e76ac0d

Please sign in to comment.