Skip to content

Commit 1ce45fb

Browse files
Suppress must_use in compiler and tools
1 parent 947e1ee commit 1ce45fb

File tree

12 files changed

+26
-22
lines changed

12 files changed

+26
-22
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2174,7 +2174,7 @@ fn add_library_search_dirs(
21742174
return;
21752175
}
21762176

2177-
walk_native_lib_search_dirs(
2177+
let _ = walk_native_lib_search_dirs(
21782178
sess,
21792179
self_contained_components,
21802180
apple_sdk_root,

compiler/rustc_hir_typeck/src/method/suggest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
519519
}
520520
}
521521
_ => {
522-
intravisit::walk_pat(self, p);
522+
let _ = intravisit::walk_pat(self, p);
523523
}
524524
}
525525
ControlFlow::Continue(())
@@ -542,7 +542,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
542542
method_name,
543543
sugg_let: None,
544544
};
545-
let_visitor.visit_body(&body);
545+
let _ = let_visitor.visit_body(&body);
546546
if let Some(sugg_let) = let_visitor.sugg_let
547547
&& let Some(self_ty) = self.node_ty_opt(sugg_let.init_hir_id)
548548
{

compiler/rustc_privacy/src/lib.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -1356,12 +1356,12 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
13561356
GenericParamDefKind::Lifetime => {}
13571357
GenericParamDefKind::Type { has_default, .. } => {
13581358
if has_default {
1359-
self.visit(self.tcx.type_of(param.def_id).instantiate_identity());
1359+
let _ = self.visit(self.tcx.type_of(param.def_id).instantiate_identity());
13601360
}
13611361
}
13621362
// FIXME(generic_const_exprs): May want to look inside const here
13631363
GenericParamDefKind::Const { .. } => {
1364-
self.visit(self.tcx.type_of(param.def_id).instantiate_identity());
1364+
let _ = self.visit(self.tcx.type_of(param.def_id).instantiate_identity());
13651365
}
13661366
}
13671367
}
@@ -1376,19 +1376,19 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
13761376
// consider the ones that the user wrote. This is important
13771377
// for the inferred outlives rules; see
13781378
// `tests/ui/rfc-2093-infer-outlives/privacy.rs`.
1379-
self.visit_predicates(self.tcx.explicit_predicates_of(self.item_def_id));
1379+
let _ = self.visit_predicates(self.tcx.explicit_predicates_of(self.item_def_id));
13801380
self
13811381
}
13821382

13831383
fn bounds(&mut self) -> &mut Self {
13841384
self.in_primary_interface = false;
1385-
self.visit_clauses(self.tcx.explicit_item_bounds(self.item_def_id).skip_binder());
1385+
let _ = self.visit_clauses(self.tcx.explicit_item_bounds(self.item_def_id).skip_binder());
13861386
self
13871387
}
13881388

13891389
fn ty(&mut self) -> &mut Self {
13901390
self.in_primary_interface = true;
1391-
self.visit(self.tcx.type_of(self.item_def_id).instantiate_identity());
1391+
let _ = self.visit(self.tcx.type_of(self.item_def_id).instantiate_identity());
13921392
self
13931393
}
13941394

@@ -1780,7 +1780,7 @@ fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) {
17801780

17811781
let module = tcx.hir_module_items(module_def_id);
17821782
for def_id in module.definitions() {
1783-
rustc_ty_utils::sig_types::walk_types(tcx, def_id, &mut visitor);
1783+
let _ = rustc_ty_utils::sig_types::walk_types(tcx, def_id, &mut visitor);
17841784

17851785
if let Some(body_id) = tcx.hir_maybe_body_owned_by(def_id) {
17861786
visitor.visit_nested_body(body_id.id());
@@ -1793,7 +1793,11 @@ fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) {
17931793
let trait_ref = tcx.impl_trait_ref(id.owner_id.def_id).unwrap();
17941794
let trait_ref = trait_ref.instantiate_identity();
17951795
visitor.span = item.path.span;
1796-
visitor.visit_def_id(trait_ref.def_id, "trait", &trait_ref.print_only_trait_path());
1796+
let _ = visitor.visit_def_id(
1797+
trait_ref.def_id,
1798+
"trait",
1799+
&trait_ref.print_only_trait_path(),
1800+
);
17971801
}
17981802
}
17991803
}

compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
7777
match arg.kind {
7878
hir::TyKind::BareFn(_) => {
7979
self.current_index.shift_in(1);
80-
intravisit::walk_ty(self, arg);
80+
let _ = intravisit::walk_ty(self, arg);
8181
self.current_index.shift_out(1);
8282
return ControlFlow::Continue(());
8383
}
8484

8585
hir::TyKind::TraitObject(bounds, ..) => {
8686
for bound in bounds {
8787
self.current_index.shift_in(1);
88-
self.visit_poly_trait_ref(bound);
88+
let _ = self.visit_poly_trait_ref(bound);
8989
self.current_index.shift_out(1);
9090
}
9191
}

compiler/rustc_trait_selection/src/traits/project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>(
743743
) {
744744
debug!("assemble_candidates_from_trait_def(..)");
745745
let mut ambiguous = false;
746-
selcx.for_each_item_bound(
746+
let _ = selcx.for_each_item_bound(
747747
obligation.predicate.self_ty(),
748748
|selcx, clause, _| {
749749
let Some(clause) = clause.as_projection_clause() else {

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
176176
// normalization, so try to deduplicate when possible to avoid
177177
// unnecessary ambiguity.
178178
let mut distinct_normalized_bounds = FxHashSet::default();
179-
self.for_each_item_bound::<!>(
179+
let _ = self.for_each_item_bound::<!>(
180180
placeholder_trait_predicate.self_ty(),
181181
|selcx, bound, idx| {
182182
let Some(bound) = bound.as_trait_clause() else {

compiler/rustc_type_ir/src/binder.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ where
112112
pub fn bind_with_vars(value: T, bound_vars: I::BoundVarKinds) -> Binder<I, T> {
113113
if cfg!(debug_assertions) {
114114
let mut validator = ValidateBoundVars::new(bound_vars);
115-
value.visit_with(&mut validator);
115+
let _ = value.visit_with(&mut validator);
116116
}
117117
Binder { value, bound_vars }
118118
}
@@ -196,7 +196,7 @@ impl<I: Interner, T> Binder<I, T> {
196196
let value = f(value);
197197
if cfg!(debug_assertions) {
198198
let mut validator = ValidateBoundVars::new(bound_vars);
199-
value.visit_with(&mut validator);
199+
let _ = value.visit_with(&mut validator);
200200
}
201201
Binder { value, bound_vars }
202202
}
@@ -209,7 +209,7 @@ impl<I: Interner, T> Binder<I, T> {
209209
let value = f(value)?;
210210
if cfg!(debug_assertions) {
211211
let mut validator = ValidateBoundVars::new(bound_vars);
212-
value.visit_with(&mut validator);
212+
let _ = value.visit_with(&mut validator);
213213
}
214214
Ok(Binder { value, bound_vars })
215215
}

src/librustdoc/html/markdown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,7 @@ fn markdown_summary_with_limit(
15691569

15701570
let mut buf = HtmlWithLimit::new(length_limit);
15711571
let mut stopped_early = false;
1572-
p.try_for_each(|event| {
1572+
let _ = p.try_for_each(|event| {
15731573
match &event {
15741574
Event::Text(text) => {
15751575
let r =

src/tools/clippy/clippy_lints/src/loops/mut_range_bound.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl BreakAfterExprVisitor {
127127
};
128128

129129
get_enclosing_block(cx, hir_id).is_some_and(|block| {
130-
visitor.visit_block(block);
130+
let _ = visitor.visit_block(block);
131131
visitor.break_after_expr
132132
})
133133
}

src/tools/clippy/clippy_lints/src/methods/read_line_without_trim.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn check(cx: &LateContext<'_>, call: &Expr<'_>, recv: &Expr<'_>, arg: &Expr<
4141
// We've checked that `call` is a call to `Stdin::read_line()` with the right receiver,
4242
// now let's check if the first use of the string passed to `::read_line()`
4343
// is used for operations that will always fail (e.g. parsing "6\n" into a number)
44-
for_each_local_use_after_expr(cx, local_id, call.hir_id, |expr| {
44+
let _ = for_each_local_use_after_expr(cx, local_id, call.hir_id, |expr| {
4545
if let Some(parent) = get_parent_expr(cx, expr) {
4646
let data = if let ExprKind::MethodCall(segment, recv, args, span) = parent.kind {
4747
if args.is_empty()

src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl PassByRefOrValue {
141141
// Gather all the lifetimes found in the output type which may affect whether
142142
// `TRIVIALLY_COPY_PASS_BY_REF` should be linted.
143143
let mut output_regions = FxHashSet::default();
144-
for_each_top_level_late_bound_region(fn_sig.skip_binder().output(), |region| -> ControlFlow<!> {
144+
let _ = for_each_top_level_late_bound_region(fn_sig.skip_binder().output(), |region| -> ControlFlow<!> {
145145
output_regions.insert(region);
146146
ControlFlow::Continue(())
147147
});

src/tools/clippy/clippy_lints/src/unconditional_recursion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ impl UnconditionalRecursion {
381381
implemented_ty_id,
382382
method_span,
383383
};
384-
walk_body(&mut c, body);
384+
let _ = walk_body(&mut c, body);
385385
}
386386
}
387387
}

0 commit comments

Comments
 (0)