Skip to content

Commit

Permalink
Merge PR #124 from rustafarian-dev
Browse files Browse the repository at this point in the history
Add check that only one feature http-types, mime02, or mime03 is enabled
  • Loading branch information
kaj committed Jul 9, 2023
2 parents 35501aa + 27d1e9a commit 62993ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ project adheres to

## Unreleased

* Added a check that no more than one of the http-types, mime02, or
mime03 features are enabled (PR #124). Thanks @rustafarian-dev.
* Fixed more clippy lint (PR #123). Thanks @vbrandl!
* Updated `rsass` to 0.28.0 and `itertools` to 0.11.0.

Expand Down
9 changes: 9 additions & 0 deletions src/staticfiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,15 @@ fn name_and_ext(path: &Path) -> Option<(&str, &str)> {
None
}

#[cfg(any(
all(feature = "mime03", feature = "http-types"),
all(feature = "mime02", feature = "http-types"),
all(feature = "mime02", feature = "mime03"),
))]
compile_error!(
r#"Only one of these features "http-types", "mime02" or "mime03" must be enabled at a time."#
);

/// A short and url-safe checksum string from string data.
fn checksum_slug(data: &[u8]) -> String {
use base64::prelude::{Engine, BASE64_URL_SAFE_NO_PAD};
Expand Down

0 comments on commit 62993ca

Please sign in to comment.