1
Fork 0

remove useless ?s (clippy::needless_question_marks)

Example code:
```
fn opts() -> Option<String> {
    let s: Option<String> = Some(String::new());
    Some(s?) // this can just be "s"
}
```
This commit is contained in:
Matthias Krüger 2021-02-17 23:23:57 +01:00
parent 5ef21063f0
commit f7b834831f
7 changed files with 11 additions and 18 deletions

View file

@ -1141,7 +1141,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let trait_def_ids: FxHashSet<DefId> = param
.bounds
.iter()
.filter_map(|bound| Some(bound.trait_ref()?.trait_def_id()?))
.filter_map(|bound| bound.trait_ref()?.trait_def_id())
.collect();
if !candidates.iter().any(|t| trait_def_ids.contains(&t.def_id)) {
err.span_suggestions(