Skip to content

Commit

Permalink
Allow building without the pem crate feature (#204)
Browse files Browse the repository at this point in the history
Currently trying to build like this:
```
cargo build -p rcgen --no-default-features --features ring
```
will fail because it can't find `pem::PemError` or `Error::PemError`.

Simply adding a `cfg` guard on this implementation fixes the issue.
  • Loading branch information
daxpedda committed Dec 19, 2023
1 parent d382a37 commit 44bb7c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
matrix:
features:
- --all-features
- --no-default-features --features ring
- --no-default-features --features aws_lc_rs
- --no-default-features --features aws_lc_rs,pem
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand All @@ -38,8 +45,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --all-features --all-targets
- run: cargo clippy --no-default-features --features aws_lc_rs,pem --all-targets
- run: cargo clippy ${{ matrix.features }} --all-targets

rustdoc:
name: Documentation
Expand Down
1 change: 1 addition & 0 deletions rcgen/src/key_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ impl<T> ExternalError<T> for Result<T, ring_error::Unspecified> {
}
}

#[cfg(feature = "pem")]
impl<T> ExternalError<T> for Result<T, pem::PemError> {
fn _err(self) -> Result<T, Error> {
self.map_err(|e| Error::PemError(e.to_string()))
Expand Down
2 changes: 1 addition & 1 deletion rustls-cert-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ edition.workspace = true
keywords.workspace = true

[dependencies]
rcgen = { path = "../rcgen", default-features = false }
rcgen = { path = "../rcgen", default-features = false, features = ["pem"] }
pem = { workspace = true }

0 comments on commit 44bb7c7

Please sign in to comment.