Skip to content

Commit 5308b23

Browse files
authored
Merge pull request #19484 from Veykril/push-ttvnzlkvwssk
fix: Fix new nightly lints
2 parents 00191d8 + 1e1571e commit 5308b23

File tree

26 files changed

+88
-96
lines changed

26 files changed

+88
-96
lines changed

crates/hir-def/src/expr_store/lower.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,8 +1360,7 @@ impl ExprCollector<'_> {
13601360
else {
13611361
panic!("just expanded a macro, ExpansionSpanMap should be available");
13621362
};
1363-
let old_span_map =
1364-
mem::replace(&mut self.current_span_map, Some(new_span_map.clone()));
1363+
let old_span_map = self.current_span_map.replace(new_span_map.clone());
13651364
let id = collector(self, Some(expansion.tree()));
13661365
self.current_span_map = old_span_map;
13671366
self.ast_id_map = prev_ast_id_map;

crates/hir-def/src/generics.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -329,26 +329,30 @@ impl GenericParams {
329329
params.clone()
330330
} else {
331331
Arc::new(GenericParams {
332-
type_or_consts: all_type_or_consts_enabled
333-
.then(|| params.type_or_consts.clone())
334-
.unwrap_or_else(|| {
332+
type_or_consts: if all_type_or_consts_enabled {
333+
params.type_or_consts.clone()
334+
} else {
335+
{
335336
params
336337
.type_or_consts
337338
.iter()
338339
.filter(|&(idx, _)| enabled(attr_owner_ct(idx)))
339340
.map(|(_, param)| param.clone())
340341
.collect()
341-
}),
342-
lifetimes: all_lifetimes_enabled
343-
.then(|| params.lifetimes.clone())
344-
.unwrap_or_else(|| {
342+
}
343+
},
344+
lifetimes: if all_lifetimes_enabled {
345+
params.lifetimes.clone()
346+
} else {
347+
{
345348
params
346349
.lifetimes
347350
.iter()
348351
.filter(|&(idx, _)| enabled(attr_owner_lt(idx)))
349352
.map(|(_, param)| param.clone())
350353
.collect()
351-
}),
354+
}
355+
},
352356
where_predicates: params.where_predicates.clone(),
353357
types_map: params.types_map.clone(),
354358
})

crates/hir-expand/src/attrs.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,12 @@ impl Attr {
305305
Some(Box::new(AttrInput::TokenTree(tt::TopSubtree::from_subtree(tree))))
306306
}
307307
(Some(tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct { char: '=', .. }))), _) => {
308-
let input = match input.flat_tokens().get(1) {
308+
match input.flat_tokens().get(1) {
309309
Some(tt::TokenTree::Leaf(tt::Leaf::Literal(lit))) => {
310310
Some(Box::new(AttrInput::Literal(lit.clone())))
311311
}
312312
_ => None,
313-
};
314-
input
313+
}
315314
}
316315
_ => None,
317316
};

crates/hir-expand/src/builtin/derive_macro.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,15 +1314,15 @@ fn coerce_pointee_expand(
13141314
}
13151315
})
13161316
});
1317-
let self_for_traits = make::path_from_segments(
1317+
1318+
make::path_from_segments(
13181319
[make::generic_ty_path_segment(
13191320
make::name_ref(&struct_name.text()),
13201321
self_params_for_traits,
13211322
)],
13221323
false,
13231324
)
1324-
.clone_for_update();
1325-
self_for_traits
1325+
.clone_for_update()
13261326
};
13271327

13281328
let mut span_map = span::SpanMap::empty();

crates/hir-ty/src/chalk_db.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,21 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
144144
let id_to_chalk = |id: hir_def::ImplId| id.to_chalk(self.db);
145145

146146
let mut result = vec![];
147-
if fps.is_empty() {
148-
debug!("Unrestricted search for {:?} impls...", trait_);
149-
self.for_trait_impls(trait_, self_ty_fp, |impls| {
150-
result.extend(impls.for_trait(trait_).map(id_to_chalk));
151-
ControlFlow::Continue(())
152-
})
153-
} else {
154-
self.for_trait_impls(trait_, self_ty_fp, |impls| {
155-
result.extend(
156-
fps.iter().flat_map(move |fp| {
147+
_ =
148+
if fps.is_empty() {
149+
debug!("Unrestricted search for {:?} impls...", trait_);
150+
self.for_trait_impls(trait_, self_ty_fp, |impls| {
151+
result.extend(impls.for_trait(trait_).map(id_to_chalk));
152+
ControlFlow::Continue(())
153+
})
154+
} else {
155+
self.for_trait_impls(trait_, self_ty_fp, |impls| {
156+
result.extend(fps.iter().flat_map(move |fp| {
157157
impls.for_trait_and_self_ty(trait_, *fp).map(id_to_chalk)
158-
}),
159-
);
160-
ControlFlow::Continue(())
161-
})
162-
};
158+
}));
159+
ControlFlow::Continue(())
160+
})
161+
};
163162

164163
debug!("impls_for_trait returned {} impls", result.len());
165164
result

crates/hir-ty/src/diagnostics/match_check.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl<'a> PatCtxt<'a> {
242242
ty: &Ty,
243243
subpatterns: Vec<FieldPat>,
244244
) -> PatKind {
245-
let kind = match self.infer.variant_resolution_for_pat(pat) {
245+
match self.infer.variant_resolution_for_pat(pat) {
246246
Some(variant_id) => {
247247
if let VariantId::EnumVariantId(enum_variant) = variant_id {
248248
let substs = match ty.kind(Interner) {
@@ -266,8 +266,7 @@ impl<'a> PatCtxt<'a> {
266266
self.errors.push(PatternError::UnresolvedVariant);
267267
PatKind::Wild
268268
}
269-
};
270-
kind
269+
}
271270
}
272271

273272
fn lower_path(&mut self, pat: PatId, _path: &hir_def::path::Path) -> Pat {

crates/hir-ty/src/drop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ fn has_destructor(db: &dyn HirDatabase, adt: AdtId) -> bool {
3232
},
3333
None => db.trait_impls_in_crate(module.krate()),
3434
};
35-
let result = impls.for_trait_and_self_ty(drop_trait, TyFingerprint::Adt(adt)).next().is_some();
36-
result
35+
36+
impls.for_trait_and_self_ty(drop_trait, TyFingerprint::Adt(adt)).next().is_some()
3737
}
3838

3939
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]

crates/hir-ty/src/dyn_compatibility.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub fn dyn_compatibility_of_trait_query(
115115
trait_: TraitId,
116116
) -> Option<DynCompatibilityViolation> {
117117
let mut res = None;
118-
dyn_compatibility_of_trait_with_callback(db, trait_, &mut |osv| {
118+
_ = dyn_compatibility_of_trait_with_callback(db, trait_, &mut |osv| {
119119
res = Some(osv);
120120
ControlFlow::Break(())
121121
});
@@ -592,7 +592,7 @@ fn contains_illegal_impl_trait_in_trait(
592592

593593
let ret = sig.skip_binders().ret();
594594
let mut visitor = OpaqueTypeCollector(FxHashSet::default());
595-
ret.visit_with(visitor.as_dyn(), DebruijnIndex::INNERMOST);
595+
_ = ret.visit_with(visitor.as_dyn(), DebruijnIndex::INNERMOST);
596596

597597
// Since we haven't implemented RPITIT in proper way like rustc yet,
598598
// just check whether `ret` contains RPIT for now

crates/hir-ty/src/dyn_compatibility/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn check_dyn_compatibility<'a>(
5353
continue;
5454
};
5555
let mut osvs = FxHashSet::default();
56-
dyn_compatibility_with_callback(&db, trait_id, &mut |osv| {
56+
_ = dyn_compatibility_with_callback(&db, trait_id, &mut |osv| {
5757
osvs.insert(match osv {
5858
DynCompatibilityViolation::SizedSelf => SizedSelf,
5959
DynCompatibilityViolation::SelfReferential => SelfReferential,

crates/hir-ty/src/infer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ impl<'a> InferenceContext<'a> {
11431143
non_assocs: FxHashMap::default(),
11441144
};
11451145
for ty in tait_candidates {
1146-
ty.visit_with(collector.as_dyn(), DebruijnIndex::INNERMOST);
1146+
_ = ty.visit_with(collector.as_dyn(), DebruijnIndex::INNERMOST);
11471147
}
11481148

11491149
// Non-assoc TAITs can be define-used everywhere as long as they are

0 commit comments

Comments
 (0)