Skip to content

Commit 0b4a761

Browse files
Techcablecuviper
authored andcommitted
Have emit_has methods delegate wherever possible
Per request of @cuviper in PR #70
1 parent 546f7c6 commit 0b4a761

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

src/lib.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,7 @@ impl AutoCfg {
395395
/// Any non-identifier characters in the `path` will be replaced with
396396
/// `_` in the generated config value.
397397
pub fn emit_has_path(&self, path: &str) {
398-
let cfg_flag = format!("has_{}", mangle(path));
399-
emit_possibility(&cfg_flag);
400-
if self.probe_path(path) {
401-
emit(&cfg_flag);
402-
}
398+
self.emit_path_cfg(path, &format!("has_{}", mangle(path)));
403399
}
404400

405401
/// Emits the given `cfg` value if `probe_path` returns true.
@@ -426,11 +422,7 @@ impl AutoCfg {
426422
/// Any non-identifier characters in the trait `name` will be replaced with
427423
/// `_` in the generated config value.
428424
pub fn emit_has_trait(&self, name: &str) {
429-
let cfg_flag = format!("has_{}", mangle(name));
430-
emit_possibility(&cfg_flag);
431-
if self.probe_trait(name) {
432-
emit(&cfg_flag);
433-
}
425+
self.emit_trait_cfg(name, &format!("has_{}", mangle(name)));
434426
}
435427

436428
/// Emits the given `cfg` value if `probe_trait` returns true.
@@ -457,11 +449,7 @@ impl AutoCfg {
457449
/// Any non-identifier characters in the type `name` will be replaced with
458450
/// `_` in the generated config value.
459451
pub fn emit_has_type(&self, name: &str) {
460-
let cfg_flag = format!("has_{}", mangle(name));
461-
emit_possibility(&cfg_flag);
462-
if self.probe_type(name) {
463-
emit(&cfg_flag);
464-
}
452+
self.emit_type_cfg(name, &format!("has_{}", mangle(name)));
465453
}
466454

467455
/// Emits the given `cfg` value if `probe_type` returns true.

0 commit comments

Comments
 (0)