Skip to content

Commit 0e1e70c

Browse files
committed
Fix clippy::semicolon_if_nothing_returned warnings
1 parent a590066 commit 0e1e70c

12 files changed

Lines changed: 32 additions & 31 deletions

File tree

src/binary_heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ where
222222
/// assert!(heap.is_empty());
223223
/// ```
224224
pub fn clear(&mut self) {
225-
self.data.clear()
225+
self.data.clear();
226226
}
227227

228228
/// Returns the length of the binary heap.

src/deque.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ impl<T, S: VecStorage<T> + ?Sized> Extend<T> for DequeInner<T, S> {
895895
}
896896
impl<'a, T: 'a + Copy, S: VecStorage<T> + ?Sized> Extend<&'a T> for DequeInner<T, S> {
897897
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
898-
self.extend(iter.into_iter().copied())
898+
self.extend(iter.into_iter().copied());
899899
}
900900
}
901901

src/histbuf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl<T, S: HistBufStorage<T> + ?Sized> HistoryBufferInner<T, S> {
292292
ptr::drop_in_place(ptr::slice_from_raw_parts_mut(
293293
self.data.borrow_mut().as_mut_ptr().cast::<T>(),
294294
self.len(),
295-
))
295+
));
296296
}
297297
}
298298

@@ -513,7 +513,7 @@ where
513513
where
514514
I: IntoIterator<Item = &'a T>,
515515
{
516-
self.extend(iter.into_iter().cloned())
516+
self.extend(iter.into_iter().cloned());
517517
}
518518
}
519519

@@ -817,7 +817,7 @@ mod tests {
817817
assert_eq_iter(
818818
[head, tail].iter().copied().flatten(),
819819
buffer.oldest_ordered(),
820-
)
820+
);
821821
}
822822
}
823823

src/indexmap.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ where
12961296
where
12971297
I: IntoIterator<Item = (&'a K, &'a V)>,
12981298
{
1299-
self.extend(iterable.into_iter().map(|(&key, &value)| (key, value)))
1299+
self.extend(iterable.into_iter().map(|(&key, &value)| (key, value)));
13001300
}
13011301
}
13021302

@@ -1479,7 +1479,7 @@ mod tests {
14791479
mem::size_of::<u16>() // hash
14801480
) + // buckets
14811481
mem::size_of::<usize>() // entries.length
1482-
)
1482+
);
14831483
}
14841484

14851485
#[test]
@@ -1671,7 +1671,7 @@ mod tests {
16711671
assert_eq!(value, *v.insert(value).unwrap());
16721672
}
16731673
};
1674-
assert_eq!(value, *src.get(&key).unwrap())
1674+
assert_eq!(value, *src.get(&key).unwrap());
16751675
}
16761676

16771677
#[test]
@@ -1691,7 +1691,7 @@ mod tests {
16911691
panic!("Entry not found");
16921692
}
16931693
};
1694-
assert_eq!(value2, *src.get(&key).unwrap())
1694+
assert_eq!(value2, *src.get(&key).unwrap());
16951695
}
16961696

16971697
#[test]

src/indexset.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<T, S, const N: usize> IndexSet<T, S, N> {
212212
/// assert!(v.is_empty());
213213
/// ```
214214
pub fn clear(&mut self) {
215-
self.map.clear()
215+
self.map.clear();
216216
}
217217
}
218218

@@ -560,7 +560,7 @@ where
560560
where
561561
I: IntoIterator<Item = T>,
562562
{
563-
self.map.extend(iterable.into_iter().map(|k| (k, ())))
563+
self.map.extend(iterable.into_iter().map(|k| (k, ())));
564564
}
565565
}
566566

@@ -573,7 +573,7 @@ where
573573
where
574574
I: IntoIterator<Item = &'a T>,
575575
{
576-
self.extend(iterable.into_iter().cloned())
576+
self.extend(iterable.into_iter().cloned());
577577
}
578578
}
579579

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
clippy::option_if_let_else,
148148
clippy::ptr_as_ptr,
149149
clippy::doc_markdown,
150+
clippy::semicolon_if_nothing_returned
150151
)]
151152

152153
pub use binary_heap::BinaryHeap;

src/linear_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ where
8585
/// assert!(map.is_empty());
8686
/// ```
8787
pub fn clear(&mut self) {
88-
self.buffer.clear()
88+
self.buffer.clear();
8989
}
9090

9191
/// Returns true if the map contains a value for the specified key.

src/sorted_linked_list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ where
769769
/// ```
770770
#[inline]
771771
pub fn finish(self) {
772-
drop(self)
772+
drop(self);
773773
}
774774
}
775775

@@ -924,14 +924,14 @@ mod tests {
924924
ll.push(2).unwrap();
925925
ll.push(3).unwrap();
926926

927-
assert!(ll.is_full())
927+
assert!(ll.is_full());
928928
}
929929

930930
#[test]
931931
fn test_empty() {
932932
let ll: SortedLinkedList<u32, LinkedIndexUsize, Max, 3> = SortedLinkedList::new_usize();
933933

934-
assert!(ll.is_empty())
934+
assert!(ll.is_empty());
935935
}
936936

937937
#[test]

src/spsc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl<T, S: Storage> QueueInner<T, S> {
307307
/// to create a copy of `item`, which could result in `T`'s destructor running on `item`
308308
/// twice.
309309
pub unsafe fn enqueue_unchecked(&mut self, val: T) {
310-
self.inner_enqueue_unchecked(val)
310+
self.inner_enqueue_unchecked(val);
311311
}
312312

313313
// The memory for dequeuing is "owned" by the head pointer,.
@@ -677,7 +677,7 @@ impl<T, S: Storage> ProducerInner<'_, T, S> {
677677
/// See [`Queue::enqueue_unchecked`]
678678
#[inline]
679679
pub unsafe fn enqueue_unchecked(&mut self, val: T) {
680-
self.rb.inner_enqueue_unchecked(val)
680+
self.rb.inner_enqueue_unchecked(val);
681681
}
682682

683683
/// Returns if there is any space to enqueue a new item. When this returns true, at

src/string/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl<S: VecStorage<u8> + ?Sized> StringInner<S> {
519519
pub fn truncate(&mut self, new_len: usize) {
520520
if new_len <= self.len() {
521521
assert!(self.is_char_boundary(new_len));
522-
self.vec.truncate(new_len)
522+
self.vec.truncate(new_len);
523523
}
524524
}
525525

@@ -619,7 +619,7 @@ impl<S: VecStorage<u8> + ?Sized> StringInner<S> {
619619
/// ```
620620
#[inline]
621621
pub fn clear(&mut self) {
622-
self.vec.clear()
622+
self.vec.clear();
623623
}
624624
}
625625

@@ -701,7 +701,7 @@ impl<S: VecStorage<u8> + ?Sized> fmt::Display for StringInner<S> {
701701
impl<S: VecStorage<u8> + ?Sized> hash::Hash for StringInner<S> {
702702
#[inline]
703703
fn hash<H: hash::Hasher>(&self, hasher: &mut H) {
704-
<str as hash::Hash>::hash(self, hasher)
704+
<str as hash::Hash>::hash(self, hasher);
705705
}
706706
}
707707

@@ -1153,26 +1153,26 @@ mod tests {
11531153
let number = 5;
11541154
let float = 3.12;
11551155
let formatted = format!(15; "{:0>3} plus {float}", number).unwrap();
1156-
assert_eq!(formatted, "005 plus 3.12")
1156+
assert_eq!(formatted, "005 plus 3.12");
11571157
}
11581158
#[test]
11591159
fn format_inferred_capacity() {
11601160
let number = 5;
11611161
let float = 3.12;
11621162
let formatted: String<15> = format!("{:0>3} plus {float}", number).unwrap();
1163-
assert_eq!(formatted, "005 plus 3.12")
1163+
assert_eq!(formatted, "005 plus 3.12");
11641164
}
11651165

11661166
#[test]
11671167
fn format_overflow() {
11681168
let i = 1234567;
11691169
let formatted = format!(4; "13{}", i);
1170-
assert_eq!(formatted, Err(core::fmt::Error))
1170+
assert_eq!(formatted, Err(core::fmt::Error));
11711171
}
11721172

11731173
#[test]
11741174
fn format_plain_string_overflow() {
11751175
let formatted = format!(2; "123");
1176-
assert_eq!(formatted, Err(core::fmt::Error))
1176+
assert_eq!(formatted, Err(core::fmt::Error));
11771177
}
11781178
}

0 commit comments

Comments
 (0)