Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cargo-hack --feature-powerset #38

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading