Skip to content

Commit

Permalink
chore: apply clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
forehalo committed Dec 20, 2023
1 parent 48bdeb2 commit c923b23
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 20 deletions.
1 change: 1 addition & 0 deletions y-octo-node/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct YArray {

#[napi]
impl YArray {
#[allow(clippy::new_without_default)]
#[napi(constructor)]
pub fn new() -> Self {
unimplemented!()
Expand Down
1 change: 1 addition & 0 deletions y-octo-node/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct YMap {

#[napi]
impl YMap {
#[allow(clippy::new_without_default)]
#[napi(constructor)]
pub fn new() -> Self {
unimplemented!()
Expand Down
2 changes: 2 additions & 0 deletions y-octo-node/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct YText {

#[napi]
impl YText {
#[allow(clippy::new_without_default)]
#[napi(constructor)]
pub fn new() -> Self {
unimplemented!()
Expand Down Expand Up @@ -43,6 +44,7 @@ impl YText {
self.text.len() as i64
}

#[allow(clippy::inherent_to_string)]
#[napi]
pub fn to_string(&self) -> String {
self.text.to_string()
Expand Down
1 change: 0 additions & 1 deletion y-octo/src/doc/codec/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ impl Add<Clock> for Id {
}
}

#[allow(clippy::incorrect_partial_ord_impl_on_ord_type)]
impl PartialOrd for Id {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
match self.client.cmp(&other.client) {
Expand Down
21 changes: 9 additions & 12 deletions y-octo/src/doc/common/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,18 +383,15 @@ mod tests {

#[test]
fn test_range_covered() {
assert_eq!(OrderRange::check_range_covered(&[0..1], &[2..3]), false);
assert_eq!(OrderRange::check_range_covered(&[0..1], &[0..3]), true);
assert_eq!(OrderRange::check_range_covered(&[0..1], &[1..3]), false);
assert_eq!(OrderRange::check_range_covered(&[0..1], &[0..3]), true);
assert_eq!(OrderRange::check_range_covered(&[1..2], &[0..3]), true);
assert_eq!(OrderRange::check_range_covered(&[1..2, 2..3], &[0..3]), true);
assert_eq!(OrderRange::check_range_covered(&[1..2, 2..3, 3..4], &[0..3]), false);
assert_eq!(OrderRange::check_range_covered(&[0..1, 2..3], &[0..2, 2..4]), true);
assert_eq!(
OrderRange::check_range_covered(&[0..1, 2..3, 3..4], &[0..2, 2..4]),
true
);
assert!(!OrderRange::check_range_covered(&[0..1], &[2..3]));
assert!(OrderRange::check_range_covered(&[0..1], &[0..3]));
assert!(!OrderRange::check_range_covered(&[0..1], &[1..3]));
assert!(OrderRange::check_range_covered(&[0..1], &[0..3]));
assert!(OrderRange::check_range_covered(&[1..2], &[0..3]));
assert!(OrderRange::check_range_covered(&[1..2, 2..3], &[0..3]));
assert!(!OrderRange::check_range_covered(&[1..2, 2..3, 3..4], &[0..3]));
assert!(OrderRange::check_range_covered(&[0..1, 2..3], &[0..2, 2..4]));
assert!(OrderRange::check_range_covered(&[0..1, 2..3, 3..4], &[0..2, 2..4]),);
}

#[test]
Expand Down
7 changes: 1 addition & 6 deletions y-octo/src/doc/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{

use super::Client;

#[derive(Default)]
pub struct ClientHasher(Client);

impl Hasher for ClientHasher {
Expand All @@ -19,12 +20,6 @@ impl Hasher for ClientHasher {
}
}

impl Default for ClientHasher {
fn default() -> Self {
Self(0)
}
}

#[derive(Default, Clone)]
pub struct ClientHasherBuilder;

Expand Down
2 changes: 1 addition & 1 deletion y-octo/src/doc/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ impl DocStore {
clock..clock + n.len()
})
.collect::<Vec<_>>();
if ranges.len() > 0 {
if !ranges.is_empty() {
delete_set.batch_push(*client, ranges);
}
}
Expand Down

0 comments on commit c923b23

Please sign in to comment.