Skip to content

Commit 314117b

Browse files
committed
cargo fmt
1 parent f93977b commit 314117b

File tree

6 files changed

+54
-54
lines changed

6 files changed

+54
-54
lines changed

tendril/examples/fuzz.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,57 +39,57 @@ fn fuzz() {
3939
buf_string.push_str(snip);
4040
buf_tendril.push_slice(snip);
4141
assert_eq!(&*buf_string, &*buf_tendril);
42-
}
42+
},
4343

4444
16..=31 => {
4545
let (start, end) = random_slice(&mut rng, &buf_string);
4646
let snip = &buf_string[start..end].to_owned();
4747
buf_string.push_str(&snip);
4848
buf_tendril.push_slice(&snip);
4949
assert_eq!(&*buf_string, &*buf_tendril);
50-
}
50+
},
5151

5252
32..=47 => {
5353
let lenstr = format!("[length = {}]", buf_tendril.len());
5454
buf_string.push_str(&lenstr);
5555
buf_tendril.push_slice(&lenstr);
5656
assert_eq!(&*buf_string, &*buf_tendril);
57-
}
57+
},
5858

5959
48..=63 => {
6060
let n = random_boundary(&mut rng, &buf_string);
6161
buf_tendril.pop_front(n as u32);
6262
buf_string = buf_string[n..].to_owned();
6363
assert_eq!(&*buf_string, &*buf_tendril);
64-
}
64+
},
6565

6666
64..=79 => {
6767
let new_len = random_boundary(&mut rng, &buf_string);
6868
let n = buf_string.len() - new_len;
6969
buf_string.truncate(new_len);
7070
buf_tendril.pop_back(n as u32);
7171
assert_eq!(&*buf_string, &*buf_tendril);
72-
}
72+
},
7373

7474
80..=90 => {
7575
let (start, end) = random_slice(&mut rng, &buf_string);
7676
buf_string = buf_string[start..end].to_owned();
7777
buf_tendril = buf_tendril.subtendril(start as u32, (end - start) as u32);
7878
assert_eq!(&*buf_string, &*buf_tendril);
79-
}
79+
},
8080

8181
91..=96 => {
8282
let c = rng.gen();
8383
buf_string.push(c);
8484
assert!(buf_tendril.try_push_char(c).is_ok());
8585
assert_eq!(&*buf_string, &*buf_tendril);
86-
}
86+
},
8787

8888
97 => {
8989
buf_string.truncate(0);
9090
buf_tendril.clear();
9191
assert_eq!(&*buf_string, &*buf_tendril);
92-
}
92+
},
9393

9494
_ => {
9595
let (start, end) = random_slice(&mut rng, &buf_string);
@@ -100,7 +100,7 @@ fn fuzz() {
100100
.iter()
101101
.zip(tendril_slices.iter())
102102
.all(|(s, t)| **s == **t));
103-
}
103+
},
104104
}
105105
}
106106
}

tendril/src/bench.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ fn index_words_string(input: &String) -> HashMap<char, Vec<String>> {
2020
Entry::Occupied(mut e) => {
2121
let x: &mut Vec<String> = e.get_mut();
2222
x.push(word);
23-
}
23+
},
2424
Entry::Vacant(e) => {
2525
e.insert(vec![word]);
26-
}
26+
},
2727
}
2828
}
2929
index
@@ -39,10 +39,10 @@ fn index_words_tendril(input: &StrTendril) -> HashMap<char, Vec<StrTendril>> {
3939
Some((word, true)) => match index.entry(word.chars().next().unwrap()) {
4040
Entry::Occupied(mut e) => {
4141
e.get_mut().push(word);
42-
}
42+
},
4343
Entry::Vacant(e) => {
4444
e.insert(vec![word]);
45-
}
45+
},
4646
},
4747
}
4848
}

tendril/src/futf.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ unsafe fn decode(buf: &[u8]) -> Option<Meaning> {
106106
if n < 0x80 {
107107
return None;
108108
} // Overlong
109-
}
109+
},
110110
3 => {
111111
n = ((*buf.get_unchecked(0) & 0b1111) as u32) << 12
112112
| ((*buf.get_unchecked(1) & 0x3F) as u32) << 6
@@ -115,9 +115,9 @@ unsafe fn decode(buf: &[u8]) -> Option<Meaning> {
115115
0x0000..=0x07FF => return None, // Overlong
116116
0xD800..=0xDBFF => return Some(Meaning::LeadSurrogate(n as u16 - 0xD800)),
117117
0xDC00..=0xDFFF => return Some(Meaning::TrailSurrogate(n as u16 - 0xDC00)),
118-
_ => {}
118+
_ => {},
119119
}
120-
}
120+
},
121121
4 => {
122122
n = ((*buf.get_unchecked(0) & 0b111) as u32) << 18
123123
| ((*buf.get_unchecked(1) & 0x3F) as u32) << 12
@@ -126,7 +126,7 @@ unsafe fn decode(buf: &[u8]) -> Option<Meaning> {
126126
if n < 0x1_0000 {
127127
return None;
128128
} // Overlong
129-
}
129+
},
130130
_ => debug_unreachable!(),
131131
}
132132

@@ -185,7 +185,7 @@ pub fn classify<'a>(buf: &'a [u8], idx: usize) -> Option<Codepoint<'a>> {
185185
meaning: Meaning::Prefix(n - avail),
186186
})
187187
}
188-
}
188+
},
189189
Byte::Cont => {
190190
let mut start = idx;
191191
let mut checked = 0;
@@ -225,7 +225,7 @@ pub fn classify<'a>(buf: &'a [u8], idx: usize) -> Option<Codepoint<'a>> {
225225
meaning: Meaning::Prefix(n - avail),
226226
});
227227
}
228-
}
228+
},
229229
_ => return None,
230230
}
231231

@@ -235,7 +235,7 @@ pub fn classify<'a>(buf: &'a [u8], idx: usize) -> Option<Codepoint<'a>> {
235235
return None;
236236
}
237237
}
238-
}
238+
},
239239
}
240240
}
241241
}

tendril/src/stream.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ where
9494
tendril.pop_back(BUFFER_SIZE - n as u32);
9595
self.process(tendril);
9696
break;
97-
}
98-
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {}
97+
},
98+
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {},
9999
Err(e) => return Err(e),
100100
}
101101
}
@@ -162,15 +162,15 @@ where
162162
self.inner_sink.error("invalid byte sequence".into());
163163
self.inner_sink
164164
.process(Tendril::from_slice(utf8::REPLACEMENT_CHARACTER));
165-
}
165+
},
166166
}
167167
t.len() - rest.len()
168168
});
169169
match resume_at {
170170
None => {
171171
self.incomplete = Some(incomplete);
172172
return;
173-
}
173+
},
174174
Some(resume_at) => t.pop_front(resume_at as u32),
175175
}
176176
}
@@ -180,7 +180,7 @@ where
180180
debug_assert!(s.as_ptr() == t.as_ptr());
181181
debug_assert!(s.len() == t.len());
182182
Ok(())
183-
}
183+
},
184184
Err(utf8::DecodeError::Invalid {
185185
valid_prefix,
186186
invalid_sequence,
@@ -192,21 +192,21 @@ where
192192
valid_prefix.len(),
193193
Err(valid_prefix.len() + invalid_sequence.len()),
194194
))
195-
}
195+
},
196196
Err(utf8::DecodeError::Incomplete {
197197
valid_prefix,
198198
incomplete_suffix,
199199
}) => {
200200
debug_assert!(valid_prefix.as_ptr() == t.as_ptr());
201201
debug_assert!(valid_prefix.len() <= t.len());
202202
Err((valid_prefix.len(), Ok(incomplete_suffix)))
203-
}
203+
},
204204
};
205205
match unborrowed_result {
206206
Ok(()) => {
207207
unsafe { self.inner_sink.process(t.reinterpret_without_validating()) }
208208
return;
209-
}
209+
},
210210
Err((valid_len, and_then)) => {
211211
if valid_len > 0 {
212212
let subtendril = t.subtendril(0, valid_len as u32);
@@ -219,15 +219,15 @@ where
219219
Ok(incomplete) => {
220220
self.incomplete = Some(incomplete);
221221
return;
222-
}
222+
},
223223
Err(offset) => {
224224
self.inner_sink.error("invalid byte sequence".into());
225225
self.inner_sink
226226
.process(Tendril::from_slice(utf8::REPLACEMENT_CHARACTER));
227227
t.pop_front(offset as u32);
228-
}
228+
},
229229
}
230-
}
230+
},
231231
}
232232
}
233233
}
@@ -365,21 +365,21 @@ where
365365
debug_assert!(err.upto >= 0);
366366
t.pop_front(err.upto as u32);
367367
// continue loop and process remainder of t
368-
}
368+
},
369369
(_, None) => break,
370370
}
371371
}
372372
if out.len() > 0 {
373373
sink.process(out);
374374
}
375-
}
375+
},
376376
#[cfg(feature = "encoding_rs")]
377377
LossyDecoderInner::EncodingRs(ref mut decoder, ref mut sink) => {
378378
if t.is_empty() {
379379
return;
380380
}
381381
decode_to_sink(t, decoder, sink, false);
382-
}
382+
},
383383
}
384384
}
385385

@@ -411,12 +411,12 @@ where
411411
sink.process(out);
412412
}
413413
sink.finish()
414-
}
414+
},
415415
#[cfg(feature = "encoding_rs")]
416416
LossyDecoderInner::EncodingRs(mut decoder, mut sink) => {
417417
decode_to_sink(Tendril::new(), &mut decoder, &mut sink, true);
418418
sink.finish()
419-
}
419+
},
420420
}
421421
}
422422
}
@@ -449,11 +449,11 @@ fn decode_to_sink<Sink, A>(
449449
}
450450
match result {
451451
DecoderResult::InputEmpty => return,
452-
DecoderResult::OutputFull => {}
452+
DecoderResult::OutputFull => {},
453453
DecoderResult::Malformed(_, _) => {
454454
sink.error(Cow::Borrowed("invalid sequence"));
455455
sink.process("\u{FFFD}".into());
456-
}
456+
},
457457
}
458458
t.pop_front(bytes_read as u32);
459459
if t.is_empty() {

tendril/src/tendril.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ where
11551155
self,
11561156
unsafe_slice(buf.data(), offset as usize, self.len32() as usize),
11571157
)
1158-
}
1158+
},
11591159
}
11601160
}
11611161
}
@@ -1173,7 +1173,7 @@ where
11731173
let (mut buf, _, offset) = self.assume_buf();
11741174
let len = self.len32() as usize;
11751175
copy_lifetime_mut(self, unsafe_slice_mut(buf.data_mut(), offset as usize, len))
1176-
}
1176+
},
11771177
}
11781178
}
11791179
}
@@ -1301,10 +1301,10 @@ where
13011301
if let Some((n, _)) = iter.next() {
13021302
skip = n as u32;
13031303
}
1304-
}
1304+
},
13051305
None => {
13061306
next_char = None;
1307-
}
1307+
},
13081308
}
13091309
}
13101310

@@ -1346,7 +1346,7 @@ where
13461346
let t = self.clone();
13471347
self.clear();
13481348
Some((t, class))
1349-
}
1349+
},
13501350
}
13511351
}
13521352

@@ -1400,13 +1400,13 @@ where
14001400
Ok(0) => {
14011401
ret = Ok(len - start_len);
14021402
break;
1403-
}
1403+
},
14041404
Ok(n) => len += n,
1405-
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {}
1405+
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {},
14061406
Err(e) => {
14071407
ret = Err(e);
14081408
break;
1409-
}
1409+
},
14101410
}
14111411
}
14121412

@@ -1999,7 +1999,7 @@ mod test {
19991999
let (rt, rc) = res.unwrap();
20002000
assert_eq!(es, &*rt);
20012001
assert_eq!(ec, rc);
2002-
}
2002+
},
20032003
}
20042004
}
20052005
}

0 commit comments

Comments
 (0)