Lint
This commit is contained in:
parent
6d56177ca8
commit
78fe3fd6fd
5 changed files with 7 additions and 7 deletions
|
|
@ -27,7 +27,6 @@ use crate::{
|
|||
/// in the original text. The cursor positions are updated when the operations
|
||||
/// are applied, so that the cursor positions can be used to restore the
|
||||
/// cursor positions in the updated text.
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub struct EditedText<'a, T>
|
||||
|
|
@ -93,6 +92,7 @@ where
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub fn merge(self, other: Self) -> Self {
|
||||
debug_assert_eq!(
|
||||
self.text, other.text,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use super::token::Token;
|
|||
pub fn line_tokenizer(text: &str) -> Vec<Token<String>> {
|
||||
let mut result = Vec::new();
|
||||
let mut line_start = 0;
|
||||
|
||||
|
||||
let mut chars = text.char_indices().peekable();
|
||||
while let Some((i, c)) = chars.next() {
|
||||
if c == '\n' {
|
||||
|
|
@ -32,12 +32,12 @@ pub fn line_tokenizer(text: &str) -> Vec<Token<String>> {
|
|||
line_start = i + 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add final line if any
|
||||
if line_start < text.len() {
|
||||
result.push(text[line_start..].into());
|
||||
}
|
||||
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use wasm_bindgen::prelude::*;
|
|||
|
||||
// CursorPosition represents the position of an identifiable cursor in a text
|
||||
// document based on its (UTF-8) character index.
|
||||
#[allow(clippy::unsafe_derive_deserialize)]
|
||||
#[cfg_attr(feature = "wasm", wasm_bindgen)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use crate::types::history::History;
|
|||
|
||||
/// Wrapper type for `(String, History)` where History describes the origin of
|
||||
/// `text`.
|
||||
#[allow(clippy::unsafe_derive_deserialize)]
|
||||
#[cfg_attr(feature = "wasm", wasm_bindgen)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
|
|
|||
|
|
@ -53,9 +53,7 @@ impl StringBuilder<'_> {
|
|||
|
||||
/// Returns the currently built buffer and clears it to allow consuming
|
||||
/// the result incrementally.
|
||||
pub fn take(&mut self) -> String {
|
||||
std::mem::take(&mut self.buffer)
|
||||
}
|
||||
pub fn take(&mut self) -> String { std::mem::take(&mut self.buffer) }
|
||||
|
||||
/// Get a slice of the remaining original string. The slice starts from
|
||||
/// where the next delete/retain operation would start and is of length
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue