Fix lints
This commit is contained in:
parent
df6ec254ca
commit
9af06183e7
4 changed files with 11 additions and 19 deletions
|
|
@ -41,12 +41,12 @@ lto = true
|
|||
opt-level = 3
|
||||
strip="debuginfo" # Keep some info for better panics
|
||||
|
||||
[workspace.lints.rust]
|
||||
[lints.rust]
|
||||
unsafe_code = "forbid"
|
||||
rust_2018_idioms = { level = "warn", priority = -1 }
|
||||
missing_debug_implementations = "warn"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
[lints.clippy]
|
||||
await_holding_lock = "warn"
|
||||
dbg_macro = "warn"
|
||||
empty_enum = "warn"
|
||||
|
|
|
|||
|
|
@ -137,7 +137,6 @@ where
|
|||
operation,
|
||||
Operation::Insert { .. } | Operation::Equal { .. }
|
||||
);
|
||||
println!("{side} {operation:?} ({maybe_left_op:?}, {maybe_right_op:?})");
|
||||
|
||||
let original_length = operation.len() as i64;
|
||||
let result = match side {
|
||||
|
|
@ -152,7 +151,6 @@ where
|
|||
while let Some(cursor) = left_cursors.next_if(|cursor| {
|
||||
cursor.char_index <= seen_left_length + original_length as usize
|
||||
}) {
|
||||
println!("cursor {}", cursor.char_index);
|
||||
merged_cursors.push(
|
||||
cursor.with_index((cursor.char_index as i64 + shift) as usize),
|
||||
);
|
||||
|
|
@ -179,8 +177,6 @@ where
|
|||
while let Some(cursor) = right_cursors.next_if(|cursor| {
|
||||
cursor.char_index <= seen_right_length + original_length as usize
|
||||
}) {
|
||||
println!("cursor {}", cursor.char_index);
|
||||
|
||||
merged_cursors.push(
|
||||
cursor.with_index((cursor.char_index as i64 + shift) as usize),
|
||||
);
|
||||
|
|
@ -198,8 +194,6 @@ where
|
|||
}
|
||||
};
|
||||
|
||||
println!(" = {result:?}");
|
||||
|
||||
if result.len() == 0 {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -233,8 +227,6 @@ where
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::env;
|
||||
|
||||
use insta::assert_debug_snapshot;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
|
|
|
|||
|
|
@ -96,9 +96,9 @@ where
|
|||
|
||||
fn order(&self) -> usize {
|
||||
match self {
|
||||
Operation::Equal { order, .. } => *order,
|
||||
Operation::Insert { order, .. } => *order,
|
||||
Operation::Delete { order, .. } => *order,
|
||||
Operation::Equal { order, .. }
|
||||
| Operation::Insert { order, .. }
|
||||
| Operation::Delete { order, .. } => *order,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,14 +145,14 @@ where
|
|||
.is_none_or(|text| builder.get_slice_from_remaining(self.len()) == *text),
|
||||
"Text (`{}`) which is supposed to be equal does not match the text in the \
|
||||
range: `{}`",
|
||||
text.as_ref().unwrap_or(&"".to_owned()),
|
||||
text.as_ref().unwrap_or(&String::new()),
|
||||
builder.get_slice_from_remaining(self.len())
|
||||
);
|
||||
|
||||
builder.retain(*length)
|
||||
builder.retain(*length);
|
||||
}
|
||||
Operation::Insert { text, .. } => {
|
||||
builder.insert(&text.iter().map(Token::original).collect::<String>())
|
||||
builder.insert(&text.iter().map(Token::original).collect::<String>());
|
||||
}
|
||||
Operation::Delete {
|
||||
#[cfg(debug_assertions)]
|
||||
|
|
@ -166,11 +166,11 @@ where
|
|||
.as_ref()
|
||||
.is_none_or(|text| builder.get_slice_from_remaining(self.len()) == *text),
|
||||
"Text to-be-deleted `{}` does not match the text in the range: `{}`",
|
||||
deleted_text.as_ref().unwrap_or(&"".to_owned()),
|
||||
deleted_text.as_ref().unwrap_or(&String::new()),
|
||||
builder.get_slice_from_remaining(self.len())
|
||||
);
|
||||
|
||||
builder.delete(*deleted_character_count)
|
||||
builder.delete(*deleted_character_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ impl StringBuilder<'_> {
|
|||
buffer: String::with_capacity(original.len()),
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
remaining: original.to_string(),
|
||||
remaining: original.to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue