Skip to content

Commit a6692b7

Browse files
committed
clarify when we pass () to functions (clippy::unit_arg)
1 parent 3b4c2f6 commit a6692b7

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

src/librustc_mir/interpret/eval_context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
581581
/// If `target` is `None`, that indicates the function cannot return, so we raise UB.
582582
pub fn return_to_block(&mut self, target: Option<mir::BasicBlock>) -> InterpResult<'tcx> {
583583
if let Some(target) = target {
584-
Ok(self.go_to_block(target))
584+
self.go_to_block(target);
585+
Ok(())
585586
} else {
586587
throw_ub!(Unreachable)
587588
}

src/librustc_mir/interpret/intrinsics/type_name.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ impl PrettyPrinter<'tcx> for AbsolutePathPrinter<'tcx> {
192192

193193
impl Write for AbsolutePathPrinter<'_> {
194194
fn write_str(&mut self, s: &str) -> std::fmt::Result {
195-
Ok(self.path.push_str(s))
195+
self.path.push_str(s);
196+
Ok(())
196197
}
197198
}
198199

src/librustc_mir/interpret/terminator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
370370
self.stack.pop();
371371
Err(err)
372372
}
373-
Ok(v) => Ok(v),
373+
Ok(()) => Ok(()),
374374
}
375375
}
376376
// cannot use the shim here, because that will only result in infinite recursion

src/librustc_traits/type_op.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ impl AscribeUserTypeCx<'me, 'tcx> {
8080
where
8181
T: ToTrace<'tcx>,
8282
{
83-
Ok(self
84-
.infcx
83+
self.infcx
8584
.at(&ObligationCause::dummy(), self.param_env)
8685
.relate(a, variance, b)?
87-
.into_value_registering_obligations(self.infcx, self.fulfill_cx))
86+
.into_value_registering_obligations(self.infcx, self.fulfill_cx);
87+
Ok(())
8888
}
8989

9090
fn prove_predicate(&mut self, predicate: Predicate<'tcx>) {
@@ -165,10 +165,11 @@ fn type_op_eq<'tcx>(
165165
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
166166
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |infcx, fulfill_cx, key| {
167167
let (param_env, Eq { a, b }) = key.into_parts();
168-
Ok(infcx
168+
infcx
169169
.at(&ObligationCause::dummy(), param_env)
170170
.eq(a, b)?
171-
.into_value_registering_obligations(infcx, fulfill_cx))
171+
.into_value_registering_obligations(infcx, fulfill_cx);
172+
Ok(())
172173
})
173174
}
174175

@@ -221,10 +222,11 @@ fn type_op_subtype<'tcx>(
221222
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
222223
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |infcx, fulfill_cx, key| {
223224
let (param_env, Subtype { sub, sup }) = key.into_parts();
224-
Ok(infcx
225+
infcx
225226
.at(&ObligationCause::dummy(), param_env)
226227
.sup(sup, sub)?
227-
.into_value_registering_obligations(infcx, fulfill_cx))
228+
.into_value_registering_obligations(infcx, fulfill_cx);
229+
Ok(())
228230
})
229231
}
230232

0 commit comments

Comments
 (0)