Remove some unnecessary try-related type annotations
I left a few, like
```rust
let result: Result<_, ModError<'_>> = try {
```
where it felt like seeing it might still be useful for the reader.
Feel free to push back on any of these changes if you think seeing the type would be better.
This commit is contained in:
parent
36e2b8a3a7
commit
f7931c8050
12 changed files with 45 additions and 47 deletions
|
|
@ -746,24 +746,23 @@ fn pat_ty_is_known_nonnull<'tcx>(
|
|||
typing_env: ty::TypingEnv<'tcx>,
|
||||
pat: ty::Pattern<'tcx>,
|
||||
) -> bool {
|
||||
Option::unwrap_or_default(
|
||||
try {
|
||||
match *pat {
|
||||
ty::PatternKind::Range { start, end } => {
|
||||
let start = start.try_to_value()?.try_to_bits(tcx, typing_env)?;
|
||||
let end = end.try_to_value()?.try_to_bits(tcx, typing_env)?;
|
||||
try {
|
||||
match *pat {
|
||||
ty::PatternKind::Range { start, end } => {
|
||||
let start = start.try_to_value()?.try_to_bits(tcx, typing_env)?;
|
||||
let end = end.try_to_value()?.try_to_bits(tcx, typing_env)?;
|
||||
|
||||
// This also works for negative numbers, as we just need
|
||||
// to ensure we aren't wrapping over zero.
|
||||
start > 0 && end >= start
|
||||
}
|
||||
ty::PatternKind::NotNull => true,
|
||||
ty::PatternKind::Or(patterns) => {
|
||||
patterns.iter().all(|pat| pat_ty_is_known_nonnull(tcx, typing_env, pat))
|
||||
}
|
||||
// This also works for negative numbers, as we just need
|
||||
// to ensure we aren't wrapping over zero.
|
||||
start > 0 && end >= start
|
||||
}
|
||||
},
|
||||
)
|
||||
ty::PatternKind::NotNull => true,
|
||||
ty::PatternKind::Or(patterns) => {
|
||||
patterns.iter().all(|pat| pat_ty_is_known_nonnull(tcx, typing_env, pat))
|
||||
}
|
||||
}
|
||||
}
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Given a non-null scalar (or transparent) type `ty`, return the nullable version of that type.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue