Skip to content

Commit

Permalink
Fixes for #74
Browse files Browse the repository at this point in the history
  • Loading branch information
kupiakos committed Jun 13, 2023
1 parent fe83a60 commit 643fe73
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: check
args: ${{ maxtix.features }} --workspace
args: ${{ matrix.features }} --workspace

no-std:
name: no_std Check
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ maxtix.features }} --workspace
args: ${{ maxrix.features }} --workspace

lints:
name: Lints
Expand Down Expand Up @@ -116,4 +116,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: ${{ maxtix.features }} --workspace -- -D warnings
args: ${{ matrix.features }} --workspace -- -D warnings
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libflate"
version = "2.0"
version = "2.0.0"
authors = ["Takeru Ohta <phjgt308@gmail.com>"]
description = "A Rust implementation of DEFLATE algorithm and related formats (ZLIB, GZIP)"
homepage = "https://github.com/sile/libflate"
Expand All @@ -18,7 +18,7 @@ coveralls = {repository = "sile/libflate"}
adler32 = { version = "1", default-features = false }
crc32fast = { version = "1.1.1", default-features = false }
dary_heap = "0.3.5"
libflate_lz77 = { path = "libflate_lz77", version = "2.0", default-features = false }
libflate_lz77 = { path = "libflate_lz77", version = "2.0.0", default-features = false }
core2 = { version = "0.4", default-features = false, features = ["alloc"] }

[features]
Expand Down
2 changes: 1 addition & 1 deletion libflate_lz77/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ core2 = { version = "0.4", default-features = false, features = ["alloc"] }
hashbrown = { version = "0.13" }

[dev-dependencies]
libflate = { path = "../", version = "1", default-features = false }
libflate = { path = "../", version = "2.0", default-features = false }

[features]
default = ["std"]
Expand Down
4 changes: 1 addition & 3 deletions src/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,8 @@ pub(crate) struct BitReaderState {
#[cfg(test)]
mod tests {
use super::*;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use core2::io;
#[cfg(feature = "std")]
use std::io;

#[test]
fn writer_works() {
Expand Down
3 changes: 2 additions & 1 deletion src/deflate/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ where
///
/// # Examples
/// ```
/// # extern crate alloc;
/// # use alloc::vec::Vec;
/// use core2::io::{Cursor, Read};
/// use libflate::deflate::Decoder;
Expand Down Expand Up @@ -53,7 +54,7 @@ where
///
/// # Examples
/// ```
/// use core2:io::Cursor;
/// use core2::io::Cursor;
/// use libflate::deflate::Decoder;
///
/// let encoded_data = [243, 72, 205, 201, 201, 87, 8, 207, 47, 202, 73, 81, 4, 0];
Expand Down
7 changes: 4 additions & 3 deletions src/deflate/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ where
///
/// # Examples
/// ```
/// use core2:io::Write;
/// use core2::io::Write;
/// use libflate::deflate::Encoder;
///
/// let mut encoder = Encoder::new(Vec::new());
Expand All @@ -168,7 +168,7 @@ where
///
/// # Examples
/// ```
/// use core2:io::Write;
/// use core2::io::Write;
/// use libflate::deflate::{Encoder, EncodeOptions};
///
/// let options = EncodeOptions::new().no_compression();
Expand All @@ -190,7 +190,7 @@ where
///
/// # Examples
/// ```
/// use core2:io::Write;
/// use core2::io::Write;
/// use libflate::deflate::Encoder;
///
/// let mut encoder = Encoder::new(Vec::new());
Expand Down Expand Up @@ -470,6 +470,7 @@ mod tests {
encoder.flush().expect("Flush failed");
}
let finished = encoder.finish().unwrap();
#[cfg(feature = "std")]
println!("{:?}", finished.0);

let mut output = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion src/deflate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
//! # Examples
//! ```
//! use core2:io::{Read, Write};
//! use core2::io::{Read, Write};
//! use libflate::deflate::{Encoder, Decoder};
//!
//! // Encoding
Expand Down
4 changes: 2 additions & 2 deletions src/finish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<T: Complete> AutoFinish<T> {
/// # Examples
///
/// ```
/// use core2:io::Write;
/// use core2::io::Write;
/// use libflate::finish::AutoFinish;
/// use libflate::gzip::Encoder;
///
Expand Down Expand Up @@ -167,7 +167,7 @@ impl<T: Complete> AutoFinishUnchecked<T> {
/// # Examples
///
/// ```
/// use core2:io::Write;
/// use core2::io::Write;
/// use libflate::finish::AutoFinishUnchecked;
/// use libflate::gzip::Encoder;
///
Expand Down
5 changes: 3 additions & 2 deletions src/gzip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
//! # Examples
//! ```
//! use core2:io::{Read, Write};
//! use core2::io::{Read, Write};
//! use libflate::gzip::{Encoder, Decoder};
//!
//! // Encoding
Expand Down Expand Up @@ -925,7 +925,7 @@ where
///
/// # Examples
/// ```
/// use core2:io::Read;
/// use core2::io::Read;
/// use libflate::gzip::Decoder;
///
/// let encoded_data = [31, 139, 8, 0, 123, 0, 0, 0, 0, 3, 1, 12, 0, 243, 255,
Expand Down Expand Up @@ -1170,6 +1170,7 @@ where
mod tests {
use super::*;
use crate::finish::AutoFinish;
use alloc::{vec, vec::Vec};
use core2::io::{Read, Write};

fn decode(buf: &[u8]) -> io::Result<Vec<u8>> {
Expand Down
1 change: 1 addition & 0 deletions src/lz77.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub use libflate_lz77::*;
mod tests {
use super::*;
use crate::deflate::symbol::Symbol;
use alloc::{vec, vec::Vec};

#[test]
// See: https://github.com/sile/libflate/issues/21
Expand Down
1 change: 1 addition & 0 deletions src/non_blocking/deflate/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ mod tests {
use super::*;
use crate::deflate::{EncodeOptions, Encoder};
use crate::util::{nb_read_to_end, WouldBlockReader};
use alloc::{format, string::String, vec::Vec};
use core2::io::{Read, Write};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/non_blocking/deflate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
//! # Examples
//! ```
//! use core2:io::{Read, Write};
//! use core2::io::{Read, Write};
//! use libflate::deflate::Encoder;
//! use libflate::non_blocking::deflate::Decoder;
//!
Expand Down
1 change: 1 addition & 0 deletions src/non_blocking/zlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ mod tests {
use super::*;
use crate::util::{nb_read_to_end, WouldBlockReader};
use crate::zlib::{EncodeOptions, Encoder};
use alloc::vec::Vec;
use core2::io::Write;

fn decode_all(buf: &[u8]) -> io::Result<Vec<u8>> {
Expand Down
1 change: 1 addition & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[cfg(test)]
pub(crate) mod testonly {
use alloc::vec::Vec;
use core2::io::{self, Read};

pub struct WouldBlockReader<R> {
Expand Down
7 changes: 1 addition & 6 deletions src/zlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ use crate::checksum;
use crate::deflate;
use crate::finish::{Complete, Finish};
use crate::lz77;
#[cfg(not(feature = "std"))]
use core2::io;
#[cfg(feature = "std")]
use std::io;

const COMPRESSION_METHOD_DEFLATE: u8 = 8;

Expand Down Expand Up @@ -687,10 +684,8 @@ where
mod tests {
use super::*;
use crate::finish::AutoFinish;
#[cfg(not(feature = "std"))]
use alloc::{borrow::ToOwned, string::ToString, vec, vec::Vec};
use core2::io::{Read as _, Write as _};
#[cfg(feature = "std")]
use std::io::{Read as _, Write as _};

fn decode_all(buf: &[u8]) -> io::Result<Vec<u8>> {
let mut decoder = Decoder::new(buf).unwrap();
Expand Down

0 comments on commit 643fe73

Please sign in to comment.