Skip to content

Commit 486440f

Browse files
Tweak comments and remove trivial return
1 parent 40d413f commit 486440f

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

compiler/rustc_hir_typeck/src/method/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,28 @@ pub(crate) struct MethodCallee<'tcx> {
4646

4747
#[derive(Debug)]
4848
pub(crate) enum MethodError<'tcx> {
49-
// Did not find an applicable method, but we did find various near-misses that may work.
49+
/// Did not find an applicable method, but we did find various near-misses that may work.
5050
NoMatch(NoMatchData<'tcx>),
5151

52-
// Multiple methods might apply.
52+
/// Multiple methods might apply.
5353
Ambiguity(Vec<CandidateSource>),
5454

55-
// Found an applicable method, but it is not visible. The third argument contains a list of
56-
// not-in-scope traits which may work.
55+
/// Found an applicable method, but it is not visible. The third argument contains a list of
56+
/// not-in-scope traits which may work.
5757
PrivateMatch(DefKind, DefId, Vec<DefId>),
5858

59-
// Found a `Self: Sized` bound where `Self` is a trait object.
59+
/// Found a `Self: Sized` bound where `Self` is a trait object.
6060
IllegalSizedBound {
6161
candidates: Vec<DefId>,
6262
needs_mut: bool,
6363
bound_span: Span,
6464
self_expr: &'tcx hir::Expr<'tcx>,
6565
},
6666

67-
// Found a match, but the return type is wrong
67+
/// Found a match, but the return type is wrong
6868
BadReturnType,
6969

70-
// Error has already been emitted, no need to emit another one.
70+
/// Error has already been emitted, no need to emit another one.
7171
ErrorReported(ErrorGuaranteed),
7272
}
7373

compiler/rustc_hir_typeck/src/method/suggest.rs

+15-17
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
229229
}
230230

231231
match error {
232-
MethodError::NoMatch(mut no_match_data) => {
233-
return self.report_no_match_method_error(
234-
span,
235-
rcvr_ty,
236-
item_name,
237-
call_id,
238-
source,
239-
args,
240-
sugg_span,
241-
&mut no_match_data,
242-
expected,
243-
trait_missing_method,
244-
);
245-
}
232+
MethodError::NoMatch(mut no_match_data) => self.report_no_match_method_error(
233+
span,
234+
rcvr_ty,
235+
item_name,
236+
call_id,
237+
source,
238+
args,
239+
sugg_span,
240+
&mut no_match_data,
241+
expected,
242+
trait_missing_method,
243+
),
246244

247245
MethodError::Ambiguity(mut sources) => {
248246
let mut err = struct_span_code_err!(
@@ -263,7 +261,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
263261
&mut sources,
264262
Some(sugg_span),
265263
);
266-
return err.emit();
264+
err.emit()
267265
}
268266

269267
MethodError::PrivateMatch(kind, def_id, out_of_scope_traits) => {
@@ -284,7 +282,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
284282
.unwrap_or_else(|| self.tcx.def_span(def_id));
285283
err.span_label(sp, format!("private {kind} defined here"));
286284
self.suggest_valid_traits(&mut err, item_name, out_of_scope_traits, true);
287-
return err.emit();
285+
err.emit()
288286
}
289287

290288
MethodError::IllegalSizedBound { candidates, needs_mut, bound_span, self_expr } => {
@@ -383,7 +381,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
383381
}
384382
}
385383
}
386-
return err.emit();
384+
err.emit()
387385
}
388386

389387
MethodError::ErrorReported(guar) => guar,

0 commit comments

Comments
 (0)