mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 17:53:56 +00:00
Simplify int_in_range
This commit is contained in:
parent
8969cbb22f
commit
8c9de51fa3
@ -133,13 +133,13 @@ fn next_cfg_expr(it: &mut SliceIter<tt::TokenTree>) -> Option<CfgExpr> {
|
||||
#[cfg(test)]
|
||||
impl arbitrary::Arbitrary<'_> for CfgAtom {
|
||||
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
|
||||
match u.int_in_range(0..=1)? {
|
||||
0 => Ok(CfgAtom::Flag(String::arbitrary(u)?.into())),
|
||||
1 => Ok(CfgAtom::KeyValue {
|
||||
if u.arbitrary()? {
|
||||
Ok(CfgAtom::Flag(String::arbitrary(u)?.into()))
|
||||
} else {
|
||||
Ok(CfgAtom::KeyValue {
|
||||
key: String::arbitrary(u)?.into(),
|
||||
value: String::arbitrary(u)?.into(),
|
||||
}),
|
||||
_ => unreachable!(),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user