about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-06-27 16:33:57 +0100
committerDavid Wood <david.wood@huawei.com>2022-06-30 08:59:21 +0100
commit7ee4aa700321d0dc2a763a324fd1c0828d73f70f (patch)
tree0ccd46d0bbccdf5d6abddbbf094387a9e5ac8919 /compiler/rustc_errors/src
parent48e4bf115f2c4a4ac051f49dab862610fe57f622 (diff)
downloadrust-7ee4aa700321d0dc2a763a324fd1c0828d73f70f.tar.gz
rust-7ee4aa700321d0dc2a763a324fd1c0828d73f70f.zip
lint: port non-fmt-panic diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index b8545139cec..63c0d58bc9c 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -39,6 +39,16 @@ pub trait IntoDiagnosticArg {
     fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static>;
 }
 
+impl IntoDiagnosticArg for bool {
+    fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
+        if self {
+            DiagnosticArgValue::Str(Cow::Borrowed("true"))
+        } else {
+            DiagnosticArgValue::Str(Cow::Borrowed("false"))
+        }
+    }
+}
+
 impl IntoDiagnosticArg for String {
     fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
         DiagnosticArgValue::Str(Cow::Owned(self))