Another batch of lint fixes (#36521)
- **Enable a bunch of extra lints** - **First batch of fixes** - **More fixes** Release Notes: - N/A
This commit is contained in:
parent
69b1c6d6f5
commit
6825715503
147 changed files with 788 additions and 1042 deletions
|
@ -201,10 +201,7 @@ impl Vim {
|
|||
let right_kind = classifier.kind_with(right, ignore_punctuation);
|
||||
let at_newline = (left == '\n') ^ (right == '\n');
|
||||
|
||||
let found = (left_kind != right_kind && right_kind != CharKind::Whitespace)
|
||||
|| at_newline;
|
||||
|
||||
found
|
||||
(left_kind != right_kind && right_kind != CharKind::Whitespace) || at_newline
|
||||
})
|
||||
}
|
||||
Motion::NextWordEnd { ignore_punctuation } => {
|
||||
|
@ -213,10 +210,7 @@ impl Vim {
|
|||
let right_kind = classifier.kind_with(right, ignore_punctuation);
|
||||
let at_newline = (left == '\n') ^ (right == '\n');
|
||||
|
||||
let found = (left_kind != right_kind && left_kind != CharKind::Whitespace)
|
||||
|| at_newline;
|
||||
|
||||
found
|
||||
(left_kind != right_kind && left_kind != CharKind::Whitespace) || at_newline
|
||||
})
|
||||
}
|
||||
Motion::PreviousWordStart { ignore_punctuation } => {
|
||||
|
@ -225,10 +219,7 @@ impl Vim {
|
|||
let right_kind = classifier.kind_with(right, ignore_punctuation);
|
||||
let at_newline = (left == '\n') ^ (right == '\n');
|
||||
|
||||
let found = (left_kind != right_kind && left_kind != CharKind::Whitespace)
|
||||
|| at_newline;
|
||||
|
||||
found
|
||||
(left_kind != right_kind && left_kind != CharKind::Whitespace) || at_newline
|
||||
})
|
||||
}
|
||||
Motion::PreviousWordEnd { ignore_punctuation } => {
|
||||
|
@ -237,10 +228,7 @@ impl Vim {
|
|||
let right_kind = classifier.kind_with(right, ignore_punctuation);
|
||||
let at_newline = (left == '\n') ^ (right == '\n');
|
||||
|
||||
let found = (left_kind != right_kind && right_kind != CharKind::Whitespace)
|
||||
|| at_newline;
|
||||
|
||||
found
|
||||
(left_kind != right_kind && right_kind != CharKind::Whitespace) || at_newline
|
||||
})
|
||||
}
|
||||
Motion::FindForward {
|
||||
|
|
|
@ -155,12 +155,11 @@ fn expand_changed_word_selection(
|
|||
let classifier = map
|
||||
.buffer_snapshot
|
||||
.char_classifier_at(selection.start.to_point(map));
|
||||
let in_word = map
|
||||
.buffer_chars_at(selection.head().to_offset(map, Bias::Left))
|
||||
|
||||
map.buffer_chars_at(selection.head().to_offset(map, Bias::Left))
|
||||
.next()
|
||||
.map(|(c, _)| !classifier.is_whitespace(c))
|
||||
.unwrap_or_default();
|
||||
in_word
|
||||
.unwrap_or_default()
|
||||
};
|
||||
if (times.is_none() || times.unwrap() == 1) && is_in_word() {
|
||||
let next_char = map
|
||||
|
|
|
@ -255,16 +255,11 @@ impl MarksState {
|
|||
pub fn new(workspace: &Workspace, cx: &mut App) -> Entity<MarksState> {
|
||||
cx.new(|cx| {
|
||||
let buffer_store = workspace.project().read(cx).buffer_store().clone();
|
||||
let subscription =
|
||||
cx.subscribe(
|
||||
&buffer_store,
|
||||
move |this: &mut Self, _, event, cx| match event {
|
||||
project::buffer_store::BufferStoreEvent::BufferAdded(buffer) => {
|
||||
this.on_buffer_loaded(buffer, cx);
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
);
|
||||
let subscription = cx.subscribe(&buffer_store, move |this: &mut Self, _, event, cx| {
|
||||
if let project::buffer_store::BufferStoreEvent::BufferAdded(buffer) = event {
|
||||
this.on_buffer_loaded(buffer, cx);
|
||||
}
|
||||
});
|
||||
|
||||
let mut this = Self {
|
||||
workspace: workspace.weak_handle(),
|
||||
|
@ -596,7 +591,7 @@ impl MarksState {
|
|||
if let Some(anchors) = self.buffer_marks.get(&buffer_id) {
|
||||
let text_anchors = anchors.get(name)?;
|
||||
let anchors = text_anchors
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(|anchor| Anchor::in_buffer(excerpt_id, buffer_id, *anchor))
|
||||
.collect();
|
||||
return Some(Mark::Local(anchors));
|
||||
|
@ -1710,26 +1705,25 @@ impl VimDb {
|
|||
marks: HashMap<String, Vec<Point>>,
|
||||
) -> Result<()> {
|
||||
log::debug!("Setting path {path:?} for {} marks", marks.len());
|
||||
let result = self
|
||||
.write(move |conn| {
|
||||
let mut query = conn.exec_bound(sql!(
|
||||
INSERT OR REPLACE INTO vim_marks
|
||||
(workspace_id, mark_name, path, value)
|
||||
VALUES
|
||||
(?, ?, ?, ?)
|
||||
))?;
|
||||
for (mark_name, value) in marks {
|
||||
let pairs: Vec<(u32, u32)> = value
|
||||
.into_iter()
|
||||
.map(|point| (point.row, point.column))
|
||||
.collect();
|
||||
let serialized = serde_json::to_string(&pairs)?;
|
||||
query((workspace_id, mark_name, path.clone(), serialized))?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.await;
|
||||
result
|
||||
|
||||
self.write(move |conn| {
|
||||
let mut query = conn.exec_bound(sql!(
|
||||
INSERT OR REPLACE INTO vim_marks
|
||||
(workspace_id, mark_name, path, value)
|
||||
VALUES
|
||||
(?, ?, ?, ?)
|
||||
))?;
|
||||
for (mark_name, value) in marks {
|
||||
let pairs: Vec<(u32, u32)> = value
|
||||
.into_iter()
|
||||
.map(|point| (point.row, point.column))
|
||||
.collect();
|
||||
let serialized = serde_json::to_string(&pairs)?;
|
||||
query((workspace_id, mark_name, path.clone(), serialized))?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
fn get_marks(&self, workspace_id: WorkspaceId) -> Result<Vec<SerializedMark>> {
|
||||
|
|
|
@ -590,7 +590,7 @@ fn parse_state(marked_text: &str) -> (String, Vec<Range<Point>>) {
|
|||
#[cfg(feature = "neovim")]
|
||||
fn encode_ranges(text: &str, point_ranges: &Vec<Range<Point>>) -> String {
|
||||
let byte_ranges = point_ranges
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(|range| {
|
||||
let mut byte_range = 0..0;
|
||||
let mut ix = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue