aboutsummaryrefslogtreecommitdiff
path: root/lib/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src/lib.rs')
-rw-r--r--lib/src/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/src/lib.rs b/lib/src/lib.rs
index f0f26dd..4065345 100644
--- a/lib/src/lib.rs
+++ b/lib/src/lib.rs
@@ -18,7 +18,7 @@ pub struct Report {
18} 18}
19 19
20impl Report { 20impl Report {
21 /// Construct a report. Do not invoke manually, see `lint` macro 21 /// Construct a report. Do not invoke `Report::new` manually, see `lint` macro
22 pub fn new(note: &'static str, code: u32) -> Self { 22 pub fn new(note: &'static str, code: u32) -> Self {
23 Self { 23 Self {
24 note, 24 note,
@@ -27,7 +27,7 @@ impl Report {
27 } 27 }
28 } 28 }
29 /// Add a diagnostic to this report 29 /// Add a diagnostic to this report
30 pub fn diagnostic(mut self, at: TextRange, message: String) -> Self { 30 pub fn diagnostic<S: AsRef<str>>(mut self, at: TextRange, message: S) -> Self {
31 self.diagnostics.push(Diagnostic::new(at, message)); 31 self.diagnostics.push(Diagnostic::new(at, message));
32 self 32 self
33 } 33 }
@@ -55,10 +55,10 @@ pub struct Diagnostic {
55 55
56impl Diagnostic { 56impl Diagnostic {
57 /// Construct a diagnostic. 57 /// Construct a diagnostic.
58 pub fn new(at: TextRange, message: String) -> Self { 58 pub fn new<S: AsRef<str>>(at: TextRange, message: S) -> Self {
59 Self { 59 Self {
60 at, 60 at,
61 message, 61 message: message.as_ref().into(),
62 suggestion: None, 62 suggestion: None,
63 } 63 }
64 } 64 }