Skip to content

Commit

Permalink
Merge pull request #1476 from gtk-rs/bilelmoussaoui-patch-2
Browse files Browse the repository at this point in the history
codegen: Only use any if scope constraints > 1
  • Loading branch information
sdroege authored Jun 19, 2023
2 parents 73e5ff3 + acb5434 commit 3a2fdae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/codegen/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ pub fn uses(
if !scope.is_none() {
let scope = scope.as_ref().unwrap();
if !scope.constraints.is_empty() {
writeln!(w, "#[cfg(any({}))]", scope.constraints.join(", "))?;
if scope.constraints.len() == 1 {
writeln!(w, "#[cfg({})]", scope.constraints[0])?;
} else {
writeln!(w, "#[cfg(any({}))]", scope.constraints.join(", "))?;
}
writeln!(
w,
"#[cfg_attr(docsrs, doc(cfg({})))]",
Expand Down

0 comments on commit 3a2fdae

Please sign in to comment.