mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 13:33: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)]
|
#[cfg(test)]
|
||||||
impl arbitrary::Arbitrary<'_> for CfgAtom {
|
impl arbitrary::Arbitrary<'_> for CfgAtom {
|
||||||
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
|
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
|
||||||
match u.int_in_range(0..=1)? {
|
if u.arbitrary()? {
|
||||||
0 => Ok(CfgAtom::Flag(String::arbitrary(u)?.into())),
|
Ok(CfgAtom::Flag(String::arbitrary(u)?.into()))
|
||||||
1 => Ok(CfgAtom::KeyValue {
|
} else {
|
||||||
|
Ok(CfgAtom::KeyValue {
|
||||||
key: String::arbitrary(u)?.into(),
|
key: String::arbitrary(u)?.into(),
|
||||||
value: String::arbitrary(u)?.into(),
|
value: String::arbitrary(u)?.into(),
|
||||||
}),
|
})
|
||||||
_ => unreachable!(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue