Skip to content

Commit abb0c03

Browse files
djcctz
authored andcommitted
Clean up warnings without default features
1 parent e7fd5e7 commit abb0c03

File tree

3 files changed

+4
-30
lines changed

3 files changed

+4
-30
lines changed

src/subject_name/ip_address.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1313
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414

15-
use core::{convert::TryInto, fmt::Write};
15+
use core::convert::TryInto;
16+
#[cfg(feature = "std")]
17+
use core::fmt::Write;
1618

1719
use crate::Error;
1820

tests/name_constraints.rs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1212
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1313
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14+
#![cfg(feature = "alloc")]
1415

1516
use core::convert::TryFrom;
1617
extern crate webpki;
@@ -21,13 +22,9 @@ static ALL_SIGALGS: &[&webpki::SignatureAlgorithm] = &[
2122
&webpki::ECDSA_P384_SHA256,
2223
&webpki::ECDSA_P384_SHA384,
2324
&webpki::ED25519,
24-
#[cfg(feature = "alloc")]
2525
&webpki::RSA_PKCS1_2048_8192_SHA256,
26-
#[cfg(feature = "alloc")]
2726
&webpki::RSA_PKCS1_2048_8192_SHA384,
28-
#[cfg(feature = "alloc")]
2927
&webpki::RSA_PKCS1_2048_8192_SHA512,
30-
#[cfg(feature = "alloc")]
3128
&webpki::RSA_PKCS1_3072_8192_SHA384,
3229
];
3330

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

6562
#[test]
66-
#[cfg(feature = "alloc")]
6763
fn no_name_constraints() {
6864
let ee = include_bytes!("name_constraints/no_name_constraints.ee.der");
6965
let ca = include_bytes!("name_constraints/no_name_constraints.ca.der");
@@ -74,7 +70,6 @@ fn no_name_constraints() {
7470
}
7571

7672
#[test]
77-
#[cfg(feature = "alloc")]
7873
fn additional_dns_labels() {
7974
let ee = include_bytes!("name_constraints/additional_dns_labels.ee.der");
8075
let ca = include_bytes!("name_constraints/additional_dns_labels.ca.der");
@@ -90,7 +85,6 @@ fn additional_dns_labels() {
9085
}
9186

9287
#[test]
93-
#[cfg(feature = "alloc")]
9488
fn disallow_subject_common_name() {
9589
let ee = include_bytes!("name_constraints/disallow_subject_common_name.ee.der");
9690
let ca = include_bytes!("name_constraints/disallow_subject_common_name.ca.der");
@@ -101,7 +95,6 @@ fn disallow_subject_common_name() {
10195
}
10296

10397
#[test]
104-
#[cfg(feature = "alloc")]
10598
fn disallow_dns_san() {
10699
let ee = include_bytes!("name_constraints/disallow_dns_san.ee.der");
107100
let ca = include_bytes!("name_constraints/disallow_dns_san.ca.der");
@@ -112,23 +105,20 @@ fn disallow_dns_san() {
112105
}
113106

114107
#[test]
115-
#[cfg(feature = "alloc")]
116108
fn allow_subject_common_name() {
117109
let ee = include_bytes!("name_constraints/allow_subject_common_name.ee.der");
118110
let ca = include_bytes!("name_constraints/allow_subject_common_name.ca.der");
119111
assert_eq!(check_cert(ee, ca, &[], &["allowed.example.com"]), Ok(()));
120112
}
121113

122114
#[test]
123-
#[cfg(feature = "alloc")]
124115
fn allow_dns_san() {
125116
let ee = include_bytes!("name_constraints/allow_dns_san.ee.der");
126117
let ca = include_bytes!("name_constraints/allow_dns_san.ca.der");
127118
assert_eq!(check_cert(ee, ca, &["allowed.example.com"], &[]), Ok(()));
128119
}
129120

130121
#[test]
131-
#[cfg(feature = "alloc")]
132122
fn allow_dns_san_and_subject_common_name() {
133123
let ee = include_bytes!("name_constraints/allow_dns_san_and_subject_common_name.ee.der");
134124
let ca = include_bytes!("name_constraints/allow_dns_san_and_subject_common_name.ca.der");
@@ -144,7 +134,6 @@ fn allow_dns_san_and_subject_common_name() {
144134
}
145135

146136
#[test]
147-
#[cfg(feature = "alloc")]
148137
fn allow_dns_san_and_disallow_subject_common_name() {
149138
let ee =
150139
include_bytes!("name_constraints/allow_dns_san_and_disallow_subject_common_name.ee.der");
@@ -157,7 +146,6 @@ fn allow_dns_san_and_disallow_subject_common_name() {
157146
}
158147

159148
#[test]
160-
#[cfg(feature = "alloc")]
161149
fn disallow_dns_san_and_allow_subject_common_name() {
162150
let ee =
163151
include_bytes!("name_constraints/disallow_dns_san_and_allow_subject_common_name.ee.der");
@@ -170,7 +158,6 @@ fn disallow_dns_san_and_allow_subject_common_name() {
170158
}
171159

172160
#[test]
173-
#[cfg(feature = "alloc")]
174161
fn we_incorrectly_ignore_name_constraints_on_name_in_subject() {
175162
let ee = include_bytes!(
176163
"name_constraints/we_incorrectly_ignore_name_constraints_on_name_in_subject.ee.der"
@@ -182,7 +169,6 @@ fn we_incorrectly_ignore_name_constraints_on_name_in_subject() {
182169
}
183170

184171
#[test]
185-
#[cfg(feature = "alloc")]
186172
fn reject_constraints_on_unimplemented_names() {
187173
let ee = include_bytes!("name_constraints/reject_constraints_on_unimplemented_names.ee.der");
188174
let ca = include_bytes!("name_constraints/reject_constraints_on_unimplemented_names.ca.der");
@@ -193,7 +179,6 @@ fn reject_constraints_on_unimplemented_names() {
193179
}
194180

195181
#[test]
196-
#[cfg(feature = "alloc")]
197182
fn we_ignore_constraints_on_names_that_do_not_appear_in_cert() {
198183
let ee = include_bytes!(
199184
"name_constraints/we_ignore_constraints_on_names_that_do_not_appear_in_cert.ee.der"
@@ -208,7 +193,6 @@ fn we_ignore_constraints_on_names_that_do_not_appear_in_cert() {
208193
}
209194

210195
#[test]
211-
#[cfg(feature = "alloc")]
212196
fn wildcard_san_accepted_if_in_subtree() {
213197
let ee = include_bytes!("name_constraints/wildcard_san_accepted_if_in_subtree.ee.der");
214198
let ca = include_bytes!("name_constraints/wildcard_san_accepted_if_in_subtree.ca.der");
@@ -224,7 +208,6 @@ fn wildcard_san_accepted_if_in_subtree() {
224208
}
225209

226210
#[test]
227-
#[cfg(feature = "alloc")]
228211
fn wildcard_san_rejected_if_in_excluded_subtree() {
229212
let ee = include_bytes!("name_constraints/wildcard_san_rejected_if_in_excluded_subtree.ee.der");
230213
let ca = include_bytes!("name_constraints/wildcard_san_rejected_if_in_excluded_subtree.ca.der");
@@ -235,7 +218,6 @@ fn wildcard_san_rejected_if_in_excluded_subtree() {
235218
}
236219

237220
#[test]
238-
#[cfg(feature = "alloc")]
239221
fn ip4_address_san_rejected_if_in_excluded_subtree() {
240222
let ee =
241223
include_bytes!("name_constraints/ip4_address_san_rejected_if_in_excluded_subtree.ee.der");
@@ -248,7 +230,6 @@ fn ip4_address_san_rejected_if_in_excluded_subtree() {
248230
}
249231

250232
#[test]
251-
#[cfg(feature = "alloc")]
252233
fn ip4_address_san_allowed_if_outside_excluded_subtree() {
253234
let ee = include_bytes!(
254235
"name_constraints/ip4_address_san_allowed_if_outside_excluded_subtree.ee.der"
@@ -260,7 +241,6 @@ fn ip4_address_san_allowed_if_outside_excluded_subtree() {
260241
}
261242

262243
#[test]
263-
#[cfg(feature = "alloc")]
264244
fn ip4_address_san_rejected_if_excluded_is_sparse_cidr_mask() {
265245
let ee = include_bytes!(
266246
"name_constraints/ip4_address_san_rejected_if_excluded_is_sparse_cidr_mask.ee.der"
@@ -275,7 +255,6 @@ fn ip4_address_san_rejected_if_excluded_is_sparse_cidr_mask() {
275255
}
276256

277257
#[test]
278-
#[cfg(feature = "alloc")]
279258
fn ip4_address_san_allowed() {
280259
let ee = include_bytes!("name_constraints/ip4_address_san_allowed.ee.der");
281260
let ca = include_bytes!("name_constraints/ip4_address_san_allowed.ca.der");
@@ -295,7 +274,6 @@ fn ip4_address_san_allowed() {
295274
}
296275

297276
#[test]
298-
#[cfg(feature = "alloc")]
299277
fn ip6_address_san_rejected_if_in_excluded_subtree() {
300278
let ee =
301279
include_bytes!("name_constraints/ip6_address_san_rejected_if_in_excluded_subtree.ee.der");
@@ -308,7 +286,6 @@ fn ip6_address_san_rejected_if_in_excluded_subtree() {
308286
}
309287

310288
#[test]
311-
#[cfg(feature = "alloc")]
312289
fn ip6_address_san_allowed_if_outside_excluded_subtree() {
313290
let ee = include_bytes!(
314291
"name_constraints/ip6_address_san_allowed_if_outside_excluded_subtree.ee.der"
@@ -323,7 +300,6 @@ fn ip6_address_san_allowed_if_outside_excluded_subtree() {
323300
}
324301

325302
#[test]
326-
#[cfg(feature = "alloc")]
327303
fn ip6_address_san_allowed() {
328304
let ee = include_bytes!("name_constraints/ip6_address_san_allowed.ee.der");
329305
let ca = include_bytes!("name_constraints/ip6_address_san_allowed.ca.der");
@@ -339,7 +315,6 @@ fn ip6_address_san_allowed() {
339315
}
340316

341317
#[test]
342-
#[cfg(feature = "alloc")]
343318
fn ip46_mixed_address_san_allowed() {
344319
let ee = include_bytes!("name_constraints/ip46_mixed_address_san_allowed.ee.der");
345320
let ca = include_bytes!("name_constraints/ip46_mixed_address_san_allowed.ca.der");
@@ -359,7 +334,6 @@ fn ip46_mixed_address_san_allowed() {
359334
}
360335

361336
#[test]
362-
#[cfg(feature = "alloc")]
363337
fn permit_directory_name_not_implemented() {
364338
let ee = include_bytes!("name_constraints/permit_directory_name_not_implemented.ee.der");
365339
let ca = include_bytes!("name_constraints/permit_directory_name_not_implemented.ca.der");
@@ -370,7 +344,6 @@ fn permit_directory_name_not_implemented() {
370344
}
371345

372346
#[test]
373-
#[cfg(feature = "alloc")]
374347
fn exclude_directory_name_not_implemented() {
375348
let ee = include_bytes!("name_constraints/exclude_directory_name_not_implemented.ee.der");
376349
let ca = include_bytes!("name_constraints/exclude_directory_name_not_implemented.ca.der");

tests/name_constraints/generate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ def name_constraints_test(test_name,
145145

146146
print("""
147147
#[test]
148-
#[cfg(feature = "alloc")]
149148
fn %(test_name)s() {
150149
let ee = include_bytes!("name_constraints/%(test_name)s.ee.der");
151150
let ca = include_bytes!("name_constraints/%(test_name)s.ca.der");

0 commit comments

Comments
 (0)