Skip to content

Commit

Permalink
fix: change cfg's from target wasm to feature wasm-bindgen
Browse files Browse the repository at this point in the history
We don't want to limit features to wasm, only to wasm-bindgen
  • Loading branch information
erwanvivien committed Oct 9, 2023
1 parent 4bdc3d3 commit 0f6b37d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl From<SvgError> for ConvertError {
fn from(err: SvgError) -> Self {
match err {
SvgError::SvgError(svg_err) => Self::Svg(svg_err),
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "wasm-bindgen"))]
SvgError::IoError(io_err) => Self::Io(io_err),
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/convert/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct SvgBuilder {
/// Possible errors when converting to SVG
pub enum SvgError {
/// Error while writing file
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "wasm-bindgen"))]
IoError(std::io::Error),
/// Error while creating svg
SvgError(String),
Expand Down Expand Up @@ -322,7 +322,7 @@ impl SvgBuilder {
}

/// Saves the svg for a qr code to a file
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "wasm-bindgen"))]
pub fn to_file(&self, qr: &QRCode, file: &str) -> Result<(), SvgError> {
use std::fs::File;
use std::io::Write;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mod default;
mod ecl;
mod encode;
mod hardcode;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "wasm-bindgen"))]
mod helpers;
mod module;
mod placement;
Expand Down
6 changes: 3 additions & 3 deletions src/qr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::ops::{Index, IndexMut};

use crate::datamasking::Mask;
use crate::encode::Mode;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "wasm-bindgen"))]
use crate::helpers;
use crate::{encode, Version, ECL};

Expand Down Expand Up @@ -169,13 +169,13 @@ impl QRCode {

/// Prints the `QRCode` to the terminal
#[must_use]
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "wasm-bindgen"))]
pub fn to_str(&self) -> String {
helpers::print_matrix_with_margin(self)
}

/// Prints the `QRCode` to the terminal
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(feature = "wasm-bindgen"))]
pub fn print(&self) {
println!("{}", helpers::print_matrix_with_margin(self));
}
Expand Down

0 comments on commit 0f6b37d

Please sign in to comment.