Skip to content

Commit

Permalink
Clean up warnings without default features
Browse files Browse the repository at this point in the history
  • Loading branch information
djc authored and ctz committed Mar 28, 2023
1 parent e7fd5e7 commit abb0c03
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
4 changes: 3 additions & 1 deletion src/subject_name/ip_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

use core::{convert::TryInto, fmt::Write};
use core::convert::TryInto;
#[cfg(feature = "std")]
use core::fmt::Write;

use crate::Error;

Expand Down
29 changes: 1 addition & 28 deletions tests/name_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#![cfg(feature = "alloc")]

use core::convert::TryFrom;
extern crate webpki;
Expand All @@ -21,13 +22,9 @@ static ALL_SIGALGS: &[&webpki::SignatureAlgorithm] = &[
&webpki::ECDSA_P384_SHA256,
&webpki::ECDSA_P384_SHA384,
&webpki::ED25519,
#[cfg(feature = "alloc")]
&webpki::RSA_PKCS1_2048_8192_SHA256,
#[cfg(feature = "alloc")]
&webpki::RSA_PKCS1_2048_8192_SHA384,
#[cfg(feature = "alloc")]
&webpki::RSA_PKCS1_2048_8192_SHA512,
#[cfg(feature = "alloc")]
&webpki::RSA_PKCS1_3072_8192_SHA384,
];

Expand Down Expand Up @@ -63,7 +60,6 @@ fn check_cert(
// DO NOT EDIT BELOW: generated by name_constraints/generate.py

#[test]
#[cfg(feature = "alloc")]
fn no_name_constraints() {
let ee = include_bytes!("name_constraints/no_name_constraints.ee.der");
let ca = include_bytes!("name_constraints/no_name_constraints.ca.der");
Expand All @@ -74,7 +70,6 @@ fn no_name_constraints() {
}

#[test]
#[cfg(feature = "alloc")]
fn additional_dns_labels() {
let ee = include_bytes!("name_constraints/additional_dns_labels.ee.der");
let ca = include_bytes!("name_constraints/additional_dns_labels.ca.der");
Expand All @@ -90,7 +85,6 @@ fn additional_dns_labels() {
}

#[test]
#[cfg(feature = "alloc")]
fn disallow_subject_common_name() {
let ee = include_bytes!("name_constraints/disallow_subject_common_name.ee.der");
let ca = include_bytes!("name_constraints/disallow_subject_common_name.ca.der");
Expand All @@ -101,7 +95,6 @@ fn disallow_subject_common_name() {
}

#[test]
#[cfg(feature = "alloc")]
fn disallow_dns_san() {
let ee = include_bytes!("name_constraints/disallow_dns_san.ee.der");
let ca = include_bytes!("name_constraints/disallow_dns_san.ca.der");
Expand All @@ -112,23 +105,20 @@ fn disallow_dns_san() {
}

#[test]
#[cfg(feature = "alloc")]
fn allow_subject_common_name() {
let ee = include_bytes!("name_constraints/allow_subject_common_name.ee.der");
let ca = include_bytes!("name_constraints/allow_subject_common_name.ca.der");
assert_eq!(check_cert(ee, ca, &[], &["allowed.example.com"]), Ok(()));
}

#[test]
#[cfg(feature = "alloc")]
fn allow_dns_san() {
let ee = include_bytes!("name_constraints/allow_dns_san.ee.der");
let ca = include_bytes!("name_constraints/allow_dns_san.ca.der");
assert_eq!(check_cert(ee, ca, &["allowed.example.com"], &[]), Ok(()));
}

#[test]
#[cfg(feature = "alloc")]
fn allow_dns_san_and_subject_common_name() {
let ee = include_bytes!("name_constraints/allow_dns_san_and_subject_common_name.ee.der");
let ca = include_bytes!("name_constraints/allow_dns_san_and_subject_common_name.ca.der");
Expand All @@ -144,7 +134,6 @@ fn allow_dns_san_and_subject_common_name() {
}

#[test]
#[cfg(feature = "alloc")]
fn allow_dns_san_and_disallow_subject_common_name() {
let ee =
include_bytes!("name_constraints/allow_dns_san_and_disallow_subject_common_name.ee.der");
Expand All @@ -157,7 +146,6 @@ fn allow_dns_san_and_disallow_subject_common_name() {
}

#[test]
#[cfg(feature = "alloc")]
fn disallow_dns_san_and_allow_subject_common_name() {
let ee =
include_bytes!("name_constraints/disallow_dns_san_and_allow_subject_common_name.ee.der");
Expand All @@ -170,7 +158,6 @@ fn disallow_dns_san_and_allow_subject_common_name() {
}

#[test]
#[cfg(feature = "alloc")]
fn we_incorrectly_ignore_name_constraints_on_name_in_subject() {
let ee = include_bytes!(
"name_constraints/we_incorrectly_ignore_name_constraints_on_name_in_subject.ee.der"
Expand All @@ -182,7 +169,6 @@ fn we_incorrectly_ignore_name_constraints_on_name_in_subject() {
}

#[test]
#[cfg(feature = "alloc")]
fn reject_constraints_on_unimplemented_names() {
let ee = include_bytes!("name_constraints/reject_constraints_on_unimplemented_names.ee.der");
let ca = include_bytes!("name_constraints/reject_constraints_on_unimplemented_names.ca.der");
Expand All @@ -193,7 +179,6 @@ fn reject_constraints_on_unimplemented_names() {
}

#[test]
#[cfg(feature = "alloc")]
fn we_ignore_constraints_on_names_that_do_not_appear_in_cert() {
let ee = include_bytes!(
"name_constraints/we_ignore_constraints_on_names_that_do_not_appear_in_cert.ee.der"
Expand All @@ -208,7 +193,6 @@ fn we_ignore_constraints_on_names_that_do_not_appear_in_cert() {
}

#[test]
#[cfg(feature = "alloc")]
fn wildcard_san_accepted_if_in_subtree() {
let ee = include_bytes!("name_constraints/wildcard_san_accepted_if_in_subtree.ee.der");
let ca = include_bytes!("name_constraints/wildcard_san_accepted_if_in_subtree.ca.der");
Expand All @@ -224,7 +208,6 @@ fn wildcard_san_accepted_if_in_subtree() {
}

#[test]
#[cfg(feature = "alloc")]
fn wildcard_san_rejected_if_in_excluded_subtree() {
let ee = include_bytes!("name_constraints/wildcard_san_rejected_if_in_excluded_subtree.ee.der");
let ca = include_bytes!("name_constraints/wildcard_san_rejected_if_in_excluded_subtree.ca.der");
Expand All @@ -235,7 +218,6 @@ fn wildcard_san_rejected_if_in_excluded_subtree() {
}

#[test]
#[cfg(feature = "alloc")]
fn ip4_address_san_rejected_if_in_excluded_subtree() {
let ee =
include_bytes!("name_constraints/ip4_address_san_rejected_if_in_excluded_subtree.ee.der");
Expand All @@ -248,7 +230,6 @@ fn ip4_address_san_rejected_if_in_excluded_subtree() {
}

#[test]
#[cfg(feature = "alloc")]
fn ip4_address_san_allowed_if_outside_excluded_subtree() {
let ee = include_bytes!(
"name_constraints/ip4_address_san_allowed_if_outside_excluded_subtree.ee.der"
Expand All @@ -260,7 +241,6 @@ fn ip4_address_san_allowed_if_outside_excluded_subtree() {
}

#[test]
#[cfg(feature = "alloc")]
fn ip4_address_san_rejected_if_excluded_is_sparse_cidr_mask() {
let ee = include_bytes!(
"name_constraints/ip4_address_san_rejected_if_excluded_is_sparse_cidr_mask.ee.der"
Expand All @@ -275,7 +255,6 @@ fn ip4_address_san_rejected_if_excluded_is_sparse_cidr_mask() {
}

#[test]
#[cfg(feature = "alloc")]
fn ip4_address_san_allowed() {
let ee = include_bytes!("name_constraints/ip4_address_san_allowed.ee.der");
let ca = include_bytes!("name_constraints/ip4_address_san_allowed.ca.der");
Expand All @@ -295,7 +274,6 @@ fn ip4_address_san_allowed() {
}

#[test]
#[cfg(feature = "alloc")]
fn ip6_address_san_rejected_if_in_excluded_subtree() {
let ee =
include_bytes!("name_constraints/ip6_address_san_rejected_if_in_excluded_subtree.ee.der");
Expand All @@ -308,7 +286,6 @@ fn ip6_address_san_rejected_if_in_excluded_subtree() {
}

#[test]
#[cfg(feature = "alloc")]
fn ip6_address_san_allowed_if_outside_excluded_subtree() {
let ee = include_bytes!(
"name_constraints/ip6_address_san_allowed_if_outside_excluded_subtree.ee.der"
Expand All @@ -323,7 +300,6 @@ fn ip6_address_san_allowed_if_outside_excluded_subtree() {
}

#[test]
#[cfg(feature = "alloc")]
fn ip6_address_san_allowed() {
let ee = include_bytes!("name_constraints/ip6_address_san_allowed.ee.der");
let ca = include_bytes!("name_constraints/ip6_address_san_allowed.ca.der");
Expand All @@ -339,7 +315,6 @@ fn ip6_address_san_allowed() {
}

#[test]
#[cfg(feature = "alloc")]
fn ip46_mixed_address_san_allowed() {
let ee = include_bytes!("name_constraints/ip46_mixed_address_san_allowed.ee.der");
let ca = include_bytes!("name_constraints/ip46_mixed_address_san_allowed.ca.der");
Expand All @@ -359,7 +334,6 @@ fn ip46_mixed_address_san_allowed() {
}

#[test]
#[cfg(feature = "alloc")]
fn permit_directory_name_not_implemented() {
let ee = include_bytes!("name_constraints/permit_directory_name_not_implemented.ee.der");
let ca = include_bytes!("name_constraints/permit_directory_name_not_implemented.ca.der");
Expand All @@ -370,7 +344,6 @@ fn permit_directory_name_not_implemented() {
}

#[test]
#[cfg(feature = "alloc")]
fn exclude_directory_name_not_implemented() {
let ee = include_bytes!("name_constraints/exclude_directory_name_not_implemented.ee.der");
let ca = include_bytes!("name_constraints/exclude_directory_name_not_implemented.ca.der");
Expand Down
1 change: 0 additions & 1 deletion tests/name_constraints/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ def name_constraints_test(test_name,

print("""
#[test]
#[cfg(feature = "alloc")]
fn %(test_name)s() {
let ee = include_bytes!("name_constraints/%(test_name)s.ee.der");
let ca = include_bytes!("name_constraints/%(test_name)s.ca.der");
Expand Down

0 comments on commit abb0c03

Please sign in to comment.