Skip to content

Commit 72b823e

Browse files
authored
chore: remove unnecessary allowed lints (#82)
1 parent 54e6514 commit 72b823e

File tree

1 file changed

+31
-40
lines changed

1 file changed

+31
-40
lines changed

tui-markdown/src/lib.rs

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@
2929
//! frame.render_widget(text, frame.area());
3030
//! # }
3131
//! ~~~
32-
#![allow(
33-
unused,
34-
dead_code,
35-
unused_variables,
36-
unused_imports,
37-
unused_mut,
38-
unused_assignments
39-
)]
4032
4133
use std::sync::LazyLock;
4234
use std::vec;
@@ -48,7 +40,6 @@ use pulldown_cmark::{
4840
BlockQuoteKind, CodeBlockKind, CowStr, Event, HeadingLevel, Options, Parser, Tag, TagEnd,
4941
};
5042
use ratatui::style::{Style, Stylize};
51-
use ratatui::symbols::line;
5243
use ratatui::text::{Line, Span, Text};
5344
#[cfg(feature = "highlight-code")]
5445
use syntect::{
@@ -57,7 +48,7 @@ use syntect::{
5748
parsing::SyntaxSet,
5849
util::{as_24_bit_terminal_escaped, LinesWithEndings},
5950
};
60-
use tracing::{debug, debug_span, info, info_span, instrument, span, warn};
51+
use tracing::{debug, instrument, warn};
6152

6253
pub fn from_str(input: &str) -> Text {
6354
let mut options = Options::empty();
@@ -137,8 +128,8 @@ where
137128
Event::End(tag) => self.end_tag(tag),
138129
Event::Text(text) => self.text(text),
139130
Event::Code(code) => self.code(code),
140-
Event::Html(html) => warn!("Html not yet supported"),
141-
Event::InlineHtml(html) => warn!("Inline html not yet supported"),
131+
Event::Html(_html) => warn!("Html not yet supported"),
132+
Event::InlineHtml(_html) => warn!("Inline html not yet supported"),
142133
Event::FootnoteReference(_) => warn!("Footnote reference not yet supported"),
143134
Event::SoftBreak => self.soft_break(),
144135
Event::HardBreak => self.hard_break(),
@@ -184,7 +175,7 @@ where
184175
TagEnd::BlockQuote(_) => self.end_blockquote(),
185176
TagEnd::CodeBlock => self.end_codeblock(),
186177
TagEnd::HtmlBlock => {}
187-
TagEnd::List(is_ordered) => self.end_list(),
178+
TagEnd::List(_is_ordered) => self.end_list(),
188179
TagEnd::Item => {}
189180
TagEnd::FootnoteDefinition => {}
190181
TagEnd::Table => {}
@@ -239,13 +230,13 @@ where
239230
self.needs_newline = true
240231
}
241232

242-
fn start_blockquote(&mut self, kind: Option<BlockQuoteKind>) {
233+
fn start_blockquote(&mut self, _kind: Option<BlockQuoteKind>) {
243234
if self.needs_newline {
244235
self.push_line(Line::default());
245236
self.needs_newline = false;
246237
}
247238
self.line_prefixes.push(Span::from(">"));
248-
self.line_styles.push(Style::new().green());
239+
self.line_styles.push(styles::BLOCKQUOTE);
249240
}
250241

251242
fn end_blockquote(&mut self) {
@@ -438,7 +429,7 @@ where
438429
}
439430

440431
mod styles {
441-
use ratatui::style::{Color, Modifier, Style, Stylize};
432+
use ratatui::style::{Color, Modifier, Style};
442433

443434
pub const H1: Style = Style::new()
444435
.bg(Color::Cyan)
@@ -489,17 +480,17 @@ mod tests {
489480
}
490481

491482
#[rstest]
492-
fn empty(with_tracing: DefaultGuard) {
483+
fn empty(_with_tracing: DefaultGuard) {
493484
assert_eq!(from_str(""), Text::default());
494485
}
495486

496487
#[rstest]
497-
fn paragraph_single(with_tracing: DefaultGuard) {
488+
fn paragraph_single(_with_tracing: DefaultGuard) {
498489
assert_eq!(from_str("Hello, world!"), Text::from("Hello, world!"));
499490
}
500491

501492
#[rstest]
502-
fn paragraph_soft_break(with_tracing: DefaultGuard) {
493+
fn paragraph_soft_break(_with_tracing: DefaultGuard) {
503494
assert_eq!(
504495
from_str(indoc! {"
505496
Hello
@@ -510,7 +501,7 @@ mod tests {
510501
}
511502

512503
#[rstest]
513-
fn paragraph_multiple(with_tracing: DefaultGuard) {
504+
fn paragraph_multiple(_with_tracing: DefaultGuard) {
514505
assert_eq!(
515506
from_str(indoc! {"
516507
Paragraph 1
@@ -522,7 +513,7 @@ mod tests {
522513
}
523514

524515
#[rstest]
525-
fn headings(with_tracing: DefaultGuard) {
516+
fn headings(_with_tracing: DefaultGuard) {
526517
assert_eq!(
527518
from_str(indoc! {"
528519
# Heading 1
@@ -551,7 +542,7 @@ mod tests {
551542
/// I was having difficulty getting the right number of newlines between paragraphs, so this
552543
/// test is to help debug and ensure that.
553544
#[rstest]
554-
fn blockquote_after_paragraph(with_tracing: DefaultGuard) {
545+
fn blockquote_after_paragraph(_with_tracing: DefaultGuard) {
555546
assert_eq!(
556547
from_str(indoc! {"
557548
Hello, world!
@@ -566,15 +557,15 @@ mod tests {
566557
);
567558
}
568559
#[rstest]
569-
fn blockquote_single(with_tracing: DefaultGuard) {
560+
fn blockquote_single(_with_tracing: DefaultGuard) {
570561
assert_eq!(
571562
from_str("> Blockquote"),
572563
Text::from(Line::from_iter([">", " ", "Blockquote"]).style(styles::BLOCKQUOTE))
573564
);
574565
}
575566

576567
#[rstest]
577-
fn blockquote_soft_break(with_tracing: DefaultGuard) {
568+
fn blockquote_soft_break(_with_tracing: DefaultGuard) {
578569
assert_eq!(
579570
from_str(indoc! {"
580571
> Blockquote 1
@@ -588,7 +579,7 @@ mod tests {
588579
}
589580

590581
#[rstest]
591-
fn blockquote_multiple(with_tracing: DefaultGuard) {
582+
fn blockquote_multiple(_with_tracing: DefaultGuard) {
592583
assert_eq!(
593584
from_str(indoc! {"
594585
> Blockquote 1
@@ -604,7 +595,7 @@ mod tests {
604595
}
605596

606597
#[rstest]
607-
fn blockquote_multiple_with_break(with_tracing: DefaultGuard) {
598+
fn blockquote_multiple_with_break(_with_tracing: DefaultGuard) {
608599
assert_eq!(
609600
from_str(indoc! {"
610601
> Blockquote 1
@@ -620,7 +611,7 @@ mod tests {
620611
}
621612

622613
#[rstest]
623-
fn blockquote_nested(with_tracing: DefaultGuard) {
614+
fn blockquote_nested(_with_tracing: DefaultGuard) {
624615
assert_eq!(
625616
from_str(indoc! {"
626617
> Blockquote 1
@@ -635,7 +626,7 @@ mod tests {
635626
}
636627

637628
#[rstest]
638-
fn list_single(with_tracing: DefaultGuard) {
629+
fn list_single(_with_tracing: DefaultGuard) {
639630
assert_eq!(
640631
from_str(indoc! {"
641632
- List item 1
@@ -645,7 +636,7 @@ mod tests {
645636
}
646637

647638
#[rstest]
648-
fn list_multiple(with_tracing: DefaultGuard) {
639+
fn list_multiple(_with_tracing: DefaultGuard) {
649640
assert_eq!(
650641
from_str(indoc! {"
651642
- List item 1
@@ -659,7 +650,7 @@ mod tests {
659650
}
660651

661652
#[rstest]
662-
fn list_ordered(with_tracing: DefaultGuard) {
653+
fn list_ordered(_with_tracing: DefaultGuard) {
663654
assert_eq!(
664655
from_str(indoc! {"
665656
1. List item 1
@@ -673,7 +664,7 @@ mod tests {
673664
}
674665

675666
#[rstest]
676-
fn list_nested(with_tracing: DefaultGuard) {
667+
fn list_nested(_with_tracing: DefaultGuard) {
677668
assert_eq!(
678669
from_str(indoc! {"
679670
- List item 1
@@ -688,7 +679,7 @@ mod tests {
688679

689680
#[cfg_attr(not(feature = "highlight-code"), ignore)]
690681
#[rstest]
691-
fn highlighted_code(with_tracing: DefaultGuard) {
682+
fn highlighted_code(_with_tracing: DefaultGuard) {
692683
// Assert no extra newlines are added
693684
let highlighted_code = from_str(indoc! {"
694685
```rust
@@ -703,7 +694,7 @@ mod tests {
703694

704695
#[cfg_attr(not(feature = "highlight-code"), ignore)]
705696
#[rstest]
706-
fn highlighted_code_with_indentation(with_tracing: DefaultGuard) {
697+
fn highlighted_code_with_indentation(_with_tracing: DefaultGuard) {
707698
// Assert no extra newlines are added
708699
let highlighted_code_indented = from_str(indoc! {"
709700
```rust
@@ -723,7 +714,7 @@ mod tests {
723714

724715
#[cfg_attr(feature = "highlight-code", ignore)]
725716
#[rstest]
726-
fn unhighlighted_code(with_tracing: DefaultGuard) {
717+
fn unhighlighted_code(_with_tracing: DefaultGuard) {
727718
// Assert no extra newlines are added
728719
let unhiglighted_code = from_str(indoc! {"
729720
```rust
@@ -739,7 +730,7 @@ mod tests {
739730
}
740731

741732
#[rstest]
742-
fn inline_code(with_tracing: DefaultGuard) {
733+
fn inline_code(_with_tracing: DefaultGuard) {
743734
let text = from_str("Example of `Inline code`");
744735
insta::assert_snapshot!(text);
745736

@@ -754,31 +745,31 @@ mod tests {
754745
}
755746

756747
#[rstest]
757-
fn strong(with_tracing: DefaultGuard) {
748+
fn strong(_with_tracing: DefaultGuard) {
758749
assert_eq!(
759750
from_str("**Strong**"),
760751
Text::from(Line::from("Strong".bold()))
761752
);
762753
}
763754

764755
#[rstest]
765-
fn emphasis(with_tracing: DefaultGuard) {
756+
fn emphasis(_with_tracing: DefaultGuard) {
766757
assert_eq!(
767758
from_str("*Emphasis*"),
768759
Text::from(Line::from("Emphasis".italic()))
769760
);
770761
}
771762

772763
#[rstest]
773-
fn strikethrough(with_tracing: DefaultGuard) {
764+
fn strikethrough(_with_tracing: DefaultGuard) {
774765
assert_eq!(
775766
from_str("~~Strikethrough~~"),
776767
Text::from(Line::from("Strikethrough".crossed_out()))
777768
);
778769
}
779770

780771
#[rstest]
781-
fn strong_emphasis(with_tracing: DefaultGuard) {
772+
fn strong_emphasis(_with_tracing: DefaultGuard) {
782773
assert_eq!(
783774
from_str("**Strong *emphasis***"),
784775
Text::from(Line::from_iter([
@@ -789,7 +780,7 @@ mod tests {
789780
}
790781

791782
#[rstest]
792-
fn link(with_tracing: DefaultGuard) {
783+
fn link(_with_tracing: DefaultGuard) {
793784
assert_eq!(
794785
from_str("[Link](https://example.com)"),
795786
Text::from(Line::from_iter([

0 commit comments

Comments
 (0)