Skip to content

Commit

Permalink
Use proper imports when no feature is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
szeweq committed May 22, 2024
1 parent 9470e64 commit dd77b89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib-core/src/min/nbt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg(feature = "nbt")]
use std::{error::Error, io::{self, copy, Write}, num::NonZeroU64};
use std::{error::Error, io::{self, copy, Write}};

use crate::cfg::{acfg, CfgZopfli, ConfigHolder};
use crate::cfg::{self, acfg, ConfigHolder};

use super::Result_;

Expand Down Expand Up @@ -61,10 +61,10 @@ impl ConfigHolder<MinifierNBT> {
}

#[cfg(feature = "nbt-zopfli")]
fn minify_with_zopfli(b: &[u8], vout: &mut Vec<u8>, nbtf: NBTFormat, ic: NonZeroU64) -> Result_ {
fn minify_with_zopfli(b: &[u8], vout: &mut Vec<u8>, nbtf: NBTFormat, ic: std::num::NonZeroU64) -> Result_ {
let zo = zopfli::Options {
iteration_count: ic,
iterations_without_improvement: NonZeroU64::new(6).unwrap(),
iterations_without_improvement: std::num::NonZeroU64::new(6).unwrap(),
..<zopfli::Options as Default>::default()
};
let mut enc = zopfli::GzipEncoder::new(zo, zopfli::BlockType::Dynamic, vout)?;
Expand All @@ -79,7 +79,7 @@ fn minify_with_zopfli(b: &[u8], vout: &mut Vec<u8>, nbtf: NBTFormat, ic: NonZero
pub struct NBTConfig {
#[cfg(feature = "nbt-zopfli")]
/// Enables Zopfli compression (better, but slower)
pub use_zopfli: CfgZopfli
pub use_zopfli: cfg::CfgZopfli
}

/// An error that occurs when a minifier cannot detect the compression type of a NBT entry
Expand Down
4 changes: 2 additions & 2 deletions lib-core/src/min/png.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use state::InitCell;

use crate::cfg::{acfg, CfgZopfli, ConfigHolder};
use crate::cfg::{self, acfg, ConfigHolder};
use super::Result_;

acfg!(
Expand All @@ -24,7 +24,7 @@ pub struct PNGConfig {
#[cfg_attr(feature = "serde-cfg", serde(skip))]
oxipng_opts: InitCell<oxipng::Options>,
#[cfg(feature = "png-zopfli")]
use_zopfli: CfgZopfli
use_zopfli: cfg::CfgZopfli
}
impl PNGConfig {
fn png_opts(&self) -> &oxipng::Options {
Expand Down

0 comments on commit dd77b89

Please sign in to comment.