Skip to content

Commit

Permalink
Merge pull request #38 from fasterthanlime/powerset
Browse files Browse the repository at this point in the history
Use cargo-hack --feature-powerset
  • Loading branch information
fasterthanlime authored Jan 26, 2024
2 parents c065722 + 89fc0bb commit 149e6c1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ jobs:
run: rustup show
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install cargo-nextest
- name: Install just, nextest, cargo-llvm-cov, and cargo-hack
uses: taiki-e/install-action@v2
with:
tool: just,nextest,cargo-llvm-cov
tool: just,nextest,cargo-llvm-cov,cargo-hack
- name: Run cargo doc, deny warnings
run: |
export RUSTDOCFLAGS="-D warnings"
cargo doc --all-features --no-deps
- name: Run cargo clippy
run: |
cargo clippy --all-targets --all-features
cargo hack clippy --feature-powerset
- name: Run tests and collect coverage
run: just ci-test
- name: Upload coverage information
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
.vscode/launch.json
**/*.rs.bk
*.lcov
4 changes: 2 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _default:
just --list

check:
cargo clippy --all-features --all-targets
cargo hack clippy --feature-powerset

# Run all tests locally
test *args:
Expand All @@ -15,5 +15,5 @@ ci-test:
#!/bin/bash -eux
source <(cargo llvm-cov show-env --export-prefix)
cargo llvm-cov clean --workspace
cargo nextest run --profile ci
cargo nextest run --all-features --profile ci
cargo llvm-cov report --lcov --output-path coverage.lcov
2 changes: 2 additions & 0 deletions crates/rc-zip/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub enum Error {
pub enum UnsupportedError {
#[error("unsupported compression method: {0:?}")]
UnsupportedCompressionMethod(crate::format::Method),
#[error("compression method supported, but not enabled in this build: {0:?}")]
CompressionMethodNotEnabled(crate::format::Method),
}

/// Specific zip format errors, mostly due to invalid zip archives but that could also stem from
Expand Down
1 change: 1 addition & 0 deletions crates/rc-zip/src/reader/sync/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ where
fn get_mut(&mut self) -> &mut R;
}

#[cfg(feature = "deflate")]
impl<R> Decoder<R> for DeflateDecoder<R>
where
R: io::Read,
Expand Down
8 changes: 7 additions & 1 deletion crates/rc-zip/src/reader/sync/entry_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ where
let limited_reader = LimitedReader::new(buffer, self.inner.compressed_size);
let decoder: Box<dyn Decoder<LimitedReader>> = match self.method {
Method::Store => Box::new(StoreDecoder::new(limited_reader)),
Method::Deflate => Box::new(DeflateDecoder::new(limited_reader)),
Method::Deflate => {
#[cfg(feature = "deflate")]
{ Box::new(DeflateDecoder::new(limited_reader)) }

#[cfg(not(feature = "deflate"))]
{ return Err(Error::Unsupported(UnsupportedError::CompressionMethodNotEnabled(Method::Deflate)).into()) }
},
method => return Err(Error::Unsupported(UnsupportedError::UnsupportedCompressionMethod(method)).into()),
};

Expand Down

0 comments on commit 149e6c1

Please sign in to comment.