Skip to content

Commit db05191

Browse files
committed
Streamline ConstraintCategory::description.
1 parent 9baf49b commit db05191

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,25 @@ use crate::{MirBorrowckCtxt, borrowck_errors, fluent_generated as fluent};
4040

4141
impl<'tcx> ConstraintDescription for ConstraintCategory<'tcx> {
4242
fn description(&self) -> &'static str {
43+
use ConstraintCategory::*;
4344
// Must end with a space. Allows for empty names to be provided.
4445
match self {
45-
ConstraintCategory::Assignment => "assignment ",
46-
ConstraintCategory::Return(_) => "returning this value ",
47-
ConstraintCategory::Yield => "yielding this value ",
48-
ConstraintCategory::UseAsConst => "using this value as a constant ",
49-
ConstraintCategory::UseAsStatic => "using this value as a static ",
50-
ConstraintCategory::Cast { is_implicit_coercion: false, .. } => "cast ",
51-
ConstraintCategory::Cast { is_implicit_coercion: true, .. } => "coercion ",
52-
ConstraintCategory::CallArgument(_) => "argument ",
53-
ConstraintCategory::TypeAnnotation => "type annotation ",
54-
ConstraintCategory::ClosureBounds => "closure body ",
55-
ConstraintCategory::SizedBound => "proving this value is `Sized` ",
56-
ConstraintCategory::CopyBound => "copying this value ",
57-
ConstraintCategory::OpaqueType => "opaque type ",
58-
ConstraintCategory::ClosureUpvar(_) => "closure capture ",
59-
ConstraintCategory::Usage => "this usage ",
60-
ConstraintCategory::Predicate(_)
61-
| ConstraintCategory::Boring
62-
| ConstraintCategory::BoringNoLocation
63-
| ConstraintCategory::Internal
64-
| ConstraintCategory::IllegalUniverse => "",
46+
Assignment => "assignment ",
47+
Return(_) => "returning this value ",
48+
Yield => "yielding this value ",
49+
UseAsConst => "using this value as a constant ",
50+
UseAsStatic => "using this value as a static ",
51+
Cast { is_implicit_coercion: false, .. } => "cast ",
52+
Cast { is_implicit_coercion: true, .. } => "coercion ",
53+
CallArgument(_) => "argument ",
54+
TypeAnnotation => "type annotation ",
55+
ClosureBounds => "closure body ",
56+
SizedBound => "proving this value is `Sized` ",
57+
CopyBound => "copying this value ",
58+
OpaqueType => "opaque type ",
59+
ClosureUpvar(_) => "closure capture ",
60+
Usage => "this usage ",
61+
Predicate(_) | Boring | BoringNoLocation | Internal | IllegalUniverse => "",
6562
}
6663
}
6764
}

0 commit comments

Comments
 (0)