mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Simplify int_in_range
This commit is contained in:
parent
8969cbb22f
commit
8c9de51fa3
1 changed files with 5 additions and 5 deletions
|
@ -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 a new issue