29
29
//! frame.render_widget(text, frame.area());
30
30
//! # }
31
31
//! ~~~
32
- #![ allow(
33
- unused,
34
- dead_code,
35
- unused_variables,
36
- unused_imports,
37
- unused_mut,
38
- unused_assignments
39
- ) ]
40
32
41
33
use std:: sync:: LazyLock ;
42
34
use std:: vec;
@@ -48,7 +40,6 @@ use pulldown_cmark::{
48
40
BlockQuoteKind , CodeBlockKind , CowStr , Event , HeadingLevel , Options , Parser , Tag , TagEnd ,
49
41
} ;
50
42
use ratatui:: style:: { Style , Stylize } ;
51
- use ratatui:: symbols:: line;
52
43
use ratatui:: text:: { Line , Span , Text } ;
53
44
#[ cfg( feature = "highlight-code" ) ]
54
45
use syntect:: {
@@ -57,7 +48,7 @@ use syntect::{
57
48
parsing:: SyntaxSet ,
58
49
util:: { as_24_bit_terminal_escaped, LinesWithEndings } ,
59
50
} ;
60
- use tracing:: { debug, debug_span , info , info_span , instrument, span , warn} ;
51
+ use tracing:: { debug, instrument, warn} ;
61
52
62
53
pub fn from_str ( input : & str ) -> Text {
63
54
let mut options = Options :: empty ( ) ;
@@ -137,8 +128,8 @@ where
137
128
Event :: End ( tag) => self . end_tag ( tag) ,
138
129
Event :: Text ( text) => self . text ( text) ,
139
130
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" ) ,
142
133
Event :: FootnoteReference ( _) => warn ! ( "Footnote reference not yet supported" ) ,
143
134
Event :: SoftBreak => self . soft_break ( ) ,
144
135
Event :: HardBreak => self . hard_break ( ) ,
@@ -184,7 +175,7 @@ where
184
175
TagEnd :: BlockQuote ( _) => self . end_blockquote ( ) ,
185
176
TagEnd :: CodeBlock => self . end_codeblock ( ) ,
186
177
TagEnd :: HtmlBlock => { }
187
- TagEnd :: List ( is_ordered ) => self . end_list ( ) ,
178
+ TagEnd :: List ( _is_ordered ) => self . end_list ( ) ,
188
179
TagEnd :: Item => { }
189
180
TagEnd :: FootnoteDefinition => { }
190
181
TagEnd :: Table => { }
@@ -239,13 +230,13 @@ where
239
230
self . needs_newline = true
240
231
}
241
232
242
- fn start_blockquote ( & mut self , kind : Option < BlockQuoteKind > ) {
233
+ fn start_blockquote ( & mut self , _kind : Option < BlockQuoteKind > ) {
243
234
if self . needs_newline {
244
235
self . push_line ( Line :: default ( ) ) ;
245
236
self . needs_newline = false ;
246
237
}
247
238
self . line_prefixes . push ( Span :: from ( ">" ) ) ;
248
- self . line_styles . push ( Style :: new ( ) . green ( ) ) ;
239
+ self . line_styles . push ( styles :: BLOCKQUOTE ) ;
249
240
}
250
241
251
242
fn end_blockquote ( & mut self ) {
@@ -438,7 +429,7 @@ where
438
429
}
439
430
440
431
mod styles {
441
- use ratatui:: style:: { Color , Modifier , Style , Stylize } ;
432
+ use ratatui:: style:: { Color , Modifier , Style } ;
442
433
443
434
pub const H1 : Style = Style :: new ( )
444
435
. bg ( Color :: Cyan )
@@ -489,17 +480,17 @@ mod tests {
489
480
}
490
481
491
482
#[ rstest]
492
- fn empty ( with_tracing : DefaultGuard ) {
483
+ fn empty ( _with_tracing : DefaultGuard ) {
493
484
assert_eq ! ( from_str( "" ) , Text :: default ( ) ) ;
494
485
}
495
486
496
487
#[ rstest]
497
- fn paragraph_single ( with_tracing : DefaultGuard ) {
488
+ fn paragraph_single ( _with_tracing : DefaultGuard ) {
498
489
assert_eq ! ( from_str( "Hello, world!" ) , Text :: from( "Hello, world!" ) ) ;
499
490
}
500
491
501
492
#[ rstest]
502
- fn paragraph_soft_break ( with_tracing : DefaultGuard ) {
493
+ fn paragraph_soft_break ( _with_tracing : DefaultGuard ) {
503
494
assert_eq ! (
504
495
from_str( indoc! { "
505
496
Hello
@@ -510,7 +501,7 @@ mod tests {
510
501
}
511
502
512
503
#[ rstest]
513
- fn paragraph_multiple ( with_tracing : DefaultGuard ) {
504
+ fn paragraph_multiple ( _with_tracing : DefaultGuard ) {
514
505
assert_eq ! (
515
506
from_str( indoc! { "
516
507
Paragraph 1
@@ -522,7 +513,7 @@ mod tests {
522
513
}
523
514
524
515
#[ rstest]
525
- fn headings ( with_tracing : DefaultGuard ) {
516
+ fn headings ( _with_tracing : DefaultGuard ) {
526
517
assert_eq ! (
527
518
from_str( indoc! { "
528
519
# Heading 1
@@ -551,7 +542,7 @@ mod tests {
551
542
/// I was having difficulty getting the right number of newlines between paragraphs, so this
552
543
/// test is to help debug and ensure that.
553
544
#[ rstest]
554
- fn blockquote_after_paragraph ( with_tracing : DefaultGuard ) {
545
+ fn blockquote_after_paragraph ( _with_tracing : DefaultGuard ) {
555
546
assert_eq ! (
556
547
from_str( indoc! { "
557
548
Hello, world!
@@ -566,15 +557,15 @@ mod tests {
566
557
) ;
567
558
}
568
559
#[ rstest]
569
- fn blockquote_single ( with_tracing : DefaultGuard ) {
560
+ fn blockquote_single ( _with_tracing : DefaultGuard ) {
570
561
assert_eq ! (
571
562
from_str( "> Blockquote" ) ,
572
563
Text :: from( Line :: from_iter( [ ">" , " " , "Blockquote" ] ) . style( styles:: BLOCKQUOTE ) )
573
564
) ;
574
565
}
575
566
576
567
#[ rstest]
577
- fn blockquote_soft_break ( with_tracing : DefaultGuard ) {
568
+ fn blockquote_soft_break ( _with_tracing : DefaultGuard ) {
578
569
assert_eq ! (
579
570
from_str( indoc! { "
580
571
> Blockquote 1
@@ -588,7 +579,7 @@ mod tests {
588
579
}
589
580
590
581
#[ rstest]
591
- fn blockquote_multiple ( with_tracing : DefaultGuard ) {
582
+ fn blockquote_multiple ( _with_tracing : DefaultGuard ) {
592
583
assert_eq ! (
593
584
from_str( indoc! { "
594
585
> Blockquote 1
@@ -604,7 +595,7 @@ mod tests {
604
595
}
605
596
606
597
#[ rstest]
607
- fn blockquote_multiple_with_break ( with_tracing : DefaultGuard ) {
598
+ fn blockquote_multiple_with_break ( _with_tracing : DefaultGuard ) {
608
599
assert_eq ! (
609
600
from_str( indoc! { "
610
601
> Blockquote 1
@@ -620,7 +611,7 @@ mod tests {
620
611
}
621
612
622
613
#[ rstest]
623
- fn blockquote_nested ( with_tracing : DefaultGuard ) {
614
+ fn blockquote_nested ( _with_tracing : DefaultGuard ) {
624
615
assert_eq ! (
625
616
from_str( indoc! { "
626
617
> Blockquote 1
@@ -635,7 +626,7 @@ mod tests {
635
626
}
636
627
637
628
#[ rstest]
638
- fn list_single ( with_tracing : DefaultGuard ) {
629
+ fn list_single ( _with_tracing : DefaultGuard ) {
639
630
assert_eq ! (
640
631
from_str( indoc! { "
641
632
- List item 1
@@ -645,7 +636,7 @@ mod tests {
645
636
}
646
637
647
638
#[ rstest]
648
- fn list_multiple ( with_tracing : DefaultGuard ) {
639
+ fn list_multiple ( _with_tracing : DefaultGuard ) {
649
640
assert_eq ! (
650
641
from_str( indoc! { "
651
642
- List item 1
@@ -659,7 +650,7 @@ mod tests {
659
650
}
660
651
661
652
#[ rstest]
662
- fn list_ordered ( with_tracing : DefaultGuard ) {
653
+ fn list_ordered ( _with_tracing : DefaultGuard ) {
663
654
assert_eq ! (
664
655
from_str( indoc! { "
665
656
1. List item 1
@@ -673,7 +664,7 @@ mod tests {
673
664
}
674
665
675
666
#[ rstest]
676
- fn list_nested ( with_tracing : DefaultGuard ) {
667
+ fn list_nested ( _with_tracing : DefaultGuard ) {
677
668
assert_eq ! (
678
669
from_str( indoc! { "
679
670
- List item 1
@@ -688,7 +679,7 @@ mod tests {
688
679
689
680
#[ cfg_attr( not( feature = "highlight-code" ) , ignore) ]
690
681
#[ rstest]
691
- fn highlighted_code ( with_tracing : DefaultGuard ) {
682
+ fn highlighted_code ( _with_tracing : DefaultGuard ) {
692
683
// Assert no extra newlines are added
693
684
let highlighted_code = from_str ( indoc ! { "
694
685
```rust
@@ -703,7 +694,7 @@ mod tests {
703
694
704
695
#[ cfg_attr( not( feature = "highlight-code" ) , ignore) ]
705
696
#[ rstest]
706
- fn highlighted_code_with_indentation ( with_tracing : DefaultGuard ) {
697
+ fn highlighted_code_with_indentation ( _with_tracing : DefaultGuard ) {
707
698
// Assert no extra newlines are added
708
699
let highlighted_code_indented = from_str ( indoc ! { "
709
700
```rust
@@ -723,7 +714,7 @@ mod tests {
723
714
724
715
#[ cfg_attr( feature = "highlight-code" , ignore) ]
725
716
#[ rstest]
726
- fn unhighlighted_code ( with_tracing : DefaultGuard ) {
717
+ fn unhighlighted_code ( _with_tracing : DefaultGuard ) {
727
718
// Assert no extra newlines are added
728
719
let unhiglighted_code = from_str ( indoc ! { "
729
720
```rust
@@ -739,7 +730,7 @@ mod tests {
739
730
}
740
731
741
732
#[ rstest]
742
- fn inline_code ( with_tracing : DefaultGuard ) {
733
+ fn inline_code ( _with_tracing : DefaultGuard ) {
743
734
let text = from_str ( "Example of `Inline code`" ) ;
744
735
insta:: assert_snapshot!( text) ;
745
736
@@ -754,31 +745,31 @@ mod tests {
754
745
}
755
746
756
747
#[ rstest]
757
- fn strong ( with_tracing : DefaultGuard ) {
748
+ fn strong ( _with_tracing : DefaultGuard ) {
758
749
assert_eq ! (
759
750
from_str( "**Strong**" ) ,
760
751
Text :: from( Line :: from( "Strong" . bold( ) ) )
761
752
) ;
762
753
}
763
754
764
755
#[ rstest]
765
- fn emphasis ( with_tracing : DefaultGuard ) {
756
+ fn emphasis ( _with_tracing : DefaultGuard ) {
766
757
assert_eq ! (
767
758
from_str( "*Emphasis*" ) ,
768
759
Text :: from( Line :: from( "Emphasis" . italic( ) ) )
769
760
) ;
770
761
}
771
762
772
763
#[ rstest]
773
- fn strikethrough ( with_tracing : DefaultGuard ) {
764
+ fn strikethrough ( _with_tracing : DefaultGuard ) {
774
765
assert_eq ! (
775
766
from_str( "~~Strikethrough~~" ) ,
776
767
Text :: from( Line :: from( "Strikethrough" . crossed_out( ) ) )
777
768
) ;
778
769
}
779
770
780
771
#[ rstest]
781
- fn strong_emphasis ( with_tracing : DefaultGuard ) {
772
+ fn strong_emphasis ( _with_tracing : DefaultGuard ) {
782
773
assert_eq ! (
783
774
from_str( "**Strong *emphasis***" ) ,
784
775
Text :: from( Line :: from_iter( [
@@ -789,7 +780,7 @@ mod tests {
789
780
}
790
781
791
782
#[ rstest]
792
- fn link ( with_tracing : DefaultGuard ) {
783
+ fn link ( _with_tracing : DefaultGuard ) {
793
784
assert_eq ! (
794
785
from_str( "[Link](https://example.com)" ) ,
795
786
Text :: from( Line :: from_iter( [
0 commit comments