@@ -9,53 +9,53 @@ fn empty() {
9
9
#[ test]
10
10
fn basic ( ) {
11
11
let mut buf = HtmlWithLimit :: new ( 60 ) ;
12
- buf. push ( "Hello " ) ;
12
+ let _ = buf. push ( "Hello " ) ;
13
13
buf. open_tag ( "em" ) ;
14
- buf. push ( "world" ) ;
14
+ let _ = buf. push ( "world" ) ;
15
15
buf. close_tag ( ) ;
16
- buf. push ( "!" ) ;
16
+ let _ = buf. push ( "!" ) ;
17
17
assert_eq ! ( buf. finish( ) , "Hello <em>world</em>!" ) ;
18
18
}
19
19
20
20
#[ test]
21
21
fn no_tags ( ) {
22
22
let mut buf = HtmlWithLimit :: new ( 60 ) ;
23
- buf. push ( "Hello" ) ;
24
- buf. push ( " world!" ) ;
23
+ let _ = buf. push ( "Hello" ) ;
24
+ let _ = buf. push ( " world!" ) ;
25
25
assert_eq ! ( buf. finish( ) , "Hello world!" ) ;
26
26
}
27
27
28
28
#[ test]
29
29
fn limit_0 ( ) {
30
30
let mut buf = HtmlWithLimit :: new ( 0 ) ;
31
- buf. push ( "Hello " ) ;
31
+ let _ = buf. push ( "Hello " ) ;
32
32
buf. open_tag ( "em" ) ;
33
- buf. push ( "world" ) ;
33
+ let _ = buf. push ( "world" ) ;
34
34
buf. close_tag ( ) ;
35
- buf. push ( "!" ) ;
35
+ let _ = buf. push ( "!" ) ;
36
36
assert_eq ! ( buf. finish( ) , "" ) ;
37
37
}
38
38
39
39
#[ test]
40
40
fn exactly_limit ( ) {
41
41
let mut buf = HtmlWithLimit :: new ( 12 ) ;
42
- buf. push ( "Hello " ) ;
42
+ let _ = buf. push ( "Hello " ) ;
43
43
buf. open_tag ( "em" ) ;
44
- buf. push ( "world" ) ;
44
+ let _ = buf. push ( "world" ) ;
45
45
buf. close_tag ( ) ;
46
- buf. push ( "!" ) ;
46
+ let _ = buf. push ( "!" ) ;
47
47
assert_eq ! ( buf. finish( ) , "Hello <em>world</em>!" ) ;
48
48
}
49
49
50
50
#[ test]
51
51
fn multiple_nested_tags ( ) {
52
52
let mut buf = HtmlWithLimit :: new ( 60 ) ;
53
53
buf. open_tag ( "p" ) ;
54
- buf. push ( "This is a " ) ;
54
+ let _ = buf. push ( "This is a " ) ;
55
55
buf. open_tag ( "em" ) ;
56
- buf. push ( "paragraph" ) ;
56
+ let _ = buf. push ( "paragraph" ) ;
57
57
buf. open_tag ( "strong" ) ;
58
- buf. push ( "!" ) ;
58
+ let _ = buf. push ( "!" ) ;
59
59
buf. close_tag ( ) ;
60
60
buf. close_tag ( ) ;
61
61
buf. close_tag ( ) ;
@@ -66,22 +66,22 @@ fn multiple_nested_tags() {
66
66
fn forgot_to_close_tags ( ) {
67
67
let mut buf = HtmlWithLimit :: new ( 60 ) ;
68
68
buf. open_tag ( "p" ) ;
69
- buf. push ( "This is a " ) ;
69
+ let _ = buf. push ( "This is a " ) ;
70
70
buf. open_tag ( "em" ) ;
71
- buf. push ( "paragraph" ) ;
71
+ let _ = buf. push ( "paragraph" ) ;
72
72
buf. open_tag ( "strong" ) ;
73
- buf. push ( "!" ) ;
73
+ let _ = buf. push ( "!" ) ;
74
74
assert_eq ! ( buf. finish( ) , "<p>This is a <em>paragraph<strong>!</strong></em></p>" ) ;
75
75
}
76
76
77
77
#[ test]
78
78
fn past_the_limit ( ) {
79
79
let mut buf = HtmlWithLimit :: new ( 20 ) ;
80
80
buf. open_tag ( "p" ) ;
81
- ( 0 ..10 ) . try_for_each ( |n| {
81
+ let _ = ( 0 ..10 ) . try_for_each ( |n| {
82
82
buf. open_tag ( "strong" ) ;
83
- buf. push ( "word#" ) ?;
84
- buf. push ( & n. to_string ( ) ) ?;
83
+ let _ = buf. push ( "word#" ) ?;
84
+ let _ = buf. push ( & n. to_string ( ) ) ?;
85
85
buf. close_tag ( ) ;
86
86
ControlFlow :: Continue ( ( ) )
87
87
} ) ;
@@ -100,8 +100,8 @@ fn past_the_limit() {
100
100
fn quickly_past_the_limit ( ) {
101
101
let mut buf = HtmlWithLimit :: new ( 6 ) ;
102
102
buf. open_tag ( "p" ) ;
103
- buf. push ( "Hello" ) ;
104
- buf. push ( " World" ) ;
103
+ let _ = buf. push ( "Hello" ) ;
104
+ let _ = buf. push ( " World" ) ;
105
105
// intentionally not closing <p> before finishing
106
106
assert_eq ! ( buf. finish( ) , "<p>Hello</p>" ) ;
107
107
}
@@ -110,7 +110,7 @@ fn quickly_past_the_limit() {
110
110
fn close_too_many ( ) {
111
111
let mut buf = HtmlWithLimit :: new ( 60 ) ;
112
112
buf. open_tag ( "p" ) ;
113
- buf. push ( "Hello" ) ;
113
+ let _ = buf. push ( "Hello" ) ;
114
114
buf. close_tag ( ) ;
115
115
// This call does not panic because there are valid cases
116
116
// where `close_tag()` is called with no tags left to close.
0 commit comments