1
Fork 0

Suppress must_use for ControlFlow in rust-analyzer

This commit is contained in:
Michael Goulet 2025-02-22 23:54:56 +00:00
parent 380ce74401
commit e250bd16da
10 changed files with 17 additions and 17 deletions

View file

@ -145,19 +145,19 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
let mut result = vec![]; let mut result = vec![];
if fps.is_empty() { if fps.is_empty() {
debug!("Unrestricted search for {:?} impls...", trait_); debug!("Unrestricted search for {:?} impls...", trait_);
self.for_trait_impls(trait_, self_ty_fp, |impls| { let _ = self.for_trait_impls(trait_, self_ty_fp, |impls| {
result.extend(impls.for_trait(trait_).map(id_to_chalk)); result.extend(impls.for_trait(trait_).map(id_to_chalk));
ControlFlow::Continue(()) ControlFlow::Continue(())
}) });
} else { } else {
self.for_trait_impls(trait_, self_ty_fp, |impls| { let _ = self.for_trait_impls(trait_, self_ty_fp, |impls| {
result.extend( result.extend(
fps.iter().flat_map(move |fp| { fps.iter().flat_map(move |fp| {
impls.for_trait_and_self_ty(trait_, *fp).map(id_to_chalk) impls.for_trait_and_self_ty(trait_, *fp).map(id_to_chalk)
}), }),
); );
ControlFlow::Continue(()) ControlFlow::Continue(())
}) });
}; };
debug!("impls_for_trait returned {} impls", result.len()); debug!("impls_for_trait returned {} impls", result.len());

View file

@ -116,7 +116,7 @@ pub fn dyn_compatibility_of_trait_query(
trait_: TraitId, trait_: TraitId,
) -> Option<DynCompatibilityViolation> { ) -> Option<DynCompatibilityViolation> {
let mut res = None; let mut res = None;
dyn_compatibility_of_trait_with_callback(db, trait_, &mut |osv| { let _ = dyn_compatibility_of_trait_with_callback(db, trait_, &mut |osv| {
res = Some(osv); res = Some(osv);
ControlFlow::Break(()) ControlFlow::Break(())
}); });
@ -597,7 +597,7 @@ fn contains_illegal_impl_trait_in_trait(
let ret = sig.skip_binders().ret(); let ret = sig.skip_binders().ret();
let mut visitor = OpaqueTypeCollector(FxHashSet::default()); let mut visitor = OpaqueTypeCollector(FxHashSet::default());
ret.visit_with(visitor.as_dyn(), DebruijnIndex::INNERMOST); let _ = ret.visit_with(visitor.as_dyn(), DebruijnIndex::INNERMOST);
// Since we haven't implemented RPITIT in proper way like rustc yet, // Since we haven't implemented RPITIT in proper way like rustc yet,
// just check whether `ret` contains RPIT for now // just check whether `ret` contains RPIT for now

View file

@ -53,7 +53,7 @@ fn check_dyn_compatibility<'a>(
continue; continue;
}; };
let mut osvs = FxHashSet::default(); let mut osvs = FxHashSet::default();
dyn_compatibility_with_callback(&db, trait_id, &mut |osv| { let _ = dyn_compatibility_with_callback(&db, trait_id, &mut |osv| {
osvs.insert(match osv { osvs.insert(match osv {
DynCompatibilityViolation::SizedSelf => SizedSelf, DynCompatibilityViolation::SizedSelf => SizedSelf,
DynCompatibilityViolation::SelfReferential => SelfReferential, DynCompatibilityViolation::SelfReferential => SelfReferential,

View file

@ -1143,7 +1143,7 @@ impl<'a> InferenceContext<'a> {
non_assocs: FxHashMap::default(), non_assocs: FxHashMap::default(),
}; };
for ty in tait_candidates { for ty in tait_candidates {
ty.visit_with(collector.as_dyn(), DebruijnIndex::INNERMOST); let _ = ty.visit_with(collector.as_dyn(), DebruijnIndex::INNERMOST);
} }
// Non-assoc TAITs can be define-used everywhere as long as they are // Non-assoc TAITs can be define-used everywhere as long as they are

View file

@ -1033,7 +1033,7 @@ where
T: ?Sized + TypeVisitable<Interner>, T: ?Sized + TypeVisitable<Interner>,
{ {
let mut collector = PlaceholderCollector { db, placeholders: FxHashSet::default() }; let mut collector = PlaceholderCollector { db, placeholders: FxHashSet::default() };
value.visit_with(&mut collector, DebruijnIndex::INNERMOST); let _ = value.visit_with(&mut collector, DebruijnIndex::INNERMOST);
collector.placeholders.into_iter().collect() collector.placeholders.into_iter().collect()
} }

View file

@ -596,7 +596,7 @@ pub(crate) fn iterate_method_candidates<T>(
mut callback: impl FnMut(ReceiverAdjustments, AssocItemId, bool) -> Option<T>, mut callback: impl FnMut(ReceiverAdjustments, AssocItemId, bool) -> Option<T>,
) -> Option<T> { ) -> Option<T> {
let mut slot = None; let mut slot = None;
iterate_method_candidates_dyn( let _ = iterate_method_candidates_dyn(
ty, ty,
db, db,
env, env,

View file

@ -260,7 +260,7 @@ fn resolve_impl_trait_item(
// attributes here. Use path resolution directly instead. // attributes here. Use path resolution directly instead.
// //
// FIXME: resolve type aliases (which are not yielded by iterate_path_candidates) // FIXME: resolve type aliases (which are not yielded by iterate_path_candidates)
method_resolution::iterate_path_candidates( let _ = method_resolution::iterate_path_candidates(
&canonical, &canonical,
db, db,
environment, environment,

View file

@ -2911,7 +2911,7 @@ impl Trait {
db: &dyn HirDatabase, db: &dyn HirDatabase,
) -> Option<Vec<DynCompatibilityViolation>> { ) -> Option<Vec<DynCompatibilityViolation>> {
let mut violations = vec![]; let mut violations = vec![];
hir_ty::dyn_compatibility::dyn_compatibility_with_callback(db, self.id, &mut |violation| { let _ = hir_ty::dyn_compatibility::dyn_compatibility_with_callback(db, self.id, &mut |violation| {
violations.push(violation); violations.push(violation);
ControlFlow::Continue(()) ControlFlow::Continue(())
}); });
@ -5497,7 +5497,7 @@ impl Type {
.generic_def() .generic_def()
.map_or_else(|| TraitEnvironment::empty(krate.id), |d| db.trait_environment(d)); .map_or_else(|| TraitEnvironment::empty(krate.id), |d| db.trait_environment(d));
method_resolution::iterate_method_candidates_dyn( let _ = method_resolution::iterate_method_candidates_dyn(
&canonical, &canonical,
db, db,
environment, environment,
@ -5584,7 +5584,7 @@ impl Type {
.generic_def() .generic_def()
.map_or_else(|| TraitEnvironment::empty(krate.id), |d| db.trait_environment(d)); .map_or_else(|| TraitEnvironment::empty(krate.id), |d| db.trait_environment(d));
method_resolution::iterate_path_candidates( let _ = method_resolution::iterate_path_candidates(
&canonical, &canonical,
db, db,
environment, environment,

View file

@ -750,7 +750,7 @@ impl FunctionBody {
ast::Stmt::Item(_) => (), ast::Stmt::Item(_) => (),
ast::Stmt::LetStmt(stmt) => { ast::Stmt::LetStmt(stmt) => {
if let Some(pat) = stmt.pat() { if let Some(pat) = stmt.pat() {
walk_pat(&pat, &mut |pat| { let _ = walk_pat(&pat, &mut |pat| {
cb(pat); cb(pat);
std::ops::ControlFlow::<(), ()>::Continue(()) std::ops::ControlFlow::<(), ()>::Continue(())
}); });

View file

@ -121,7 +121,7 @@ pub fn walk_patterns_in_expr(start: &ast::Expr, cb: &mut dyn FnMut(ast::Pat)) {
match ast::Stmt::cast(node.clone()) { match ast::Stmt::cast(node.clone()) {
Some(ast::Stmt::LetStmt(l)) => { Some(ast::Stmt::LetStmt(l)) => {
if let Some(pat) = l.pat() { if let Some(pat) = l.pat() {
walk_pat(&pat, &mut |pat| { let _ = walk_pat(&pat, &mut |pat| {
cb(pat); cb(pat);
ControlFlow::<(), ()>::Continue(()) ControlFlow::<(), ()>::Continue(())
}); });
@ -159,7 +159,7 @@ pub fn walk_patterns_in_expr(start: &ast::Expr, cb: &mut dyn FnMut(ast::Pat)) {
} }
} else if let Some(pat) = ast::Pat::cast(node) { } else if let Some(pat) = ast::Pat::cast(node) {
preorder.skip_subtree(); preorder.skip_subtree();
walk_pat(&pat, &mut |pat| { let _ = walk_pat(&pat, &mut |pat| {
cb(pat); cb(pat);
ControlFlow::<(), ()>::Continue(()) ControlFlow::<(), ()>::Continue(())
}); });