diff options
author | Akshay <[email protected]> | 2021-10-03 12:27:34 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-10-03 12:28:38 +0100 |
commit | fc6409142e68335addc65763a1733526130256b0 (patch) | |
tree | e39163c7705268645b4afcb042d1bc59faec80b9 /lib/src/lib.rs | |
parent | c5c4b55c2b3a3fb824c3fd64e33bb30f1b011b71 (diff) |
new lint: collapsible_let_in
Diffstat (limited to 'lib/src/lib.rs')
-rw-r--r-- | lib/src/lib.rs | 8 |
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 | ||
20 | impl Report { | 20 | impl 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 | ||
56 | impl Diagnostic { | 56 | impl 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 | } |