Fix clippy::needless_borrow lint violations (#36444)
Release Notes: - N/A
This commit is contained in:
@@ -77,7 +77,7 @@ fn create_highlight_endpoints(
|
||||
let ranges = &text_highlights.1;
|
||||
|
||||
let start_ix = match ranges.binary_search_by(|probe| {
|
||||
let cmp = probe.end.cmp(&start, &buffer);
|
||||
let cmp = probe.end.cmp(&start, buffer);
|
||||
if cmp.is_gt() {
|
||||
cmp::Ordering::Greater
|
||||
} else {
|
||||
@@ -88,18 +88,18 @@ fn create_highlight_endpoints(
|
||||
};
|
||||
|
||||
for range in &ranges[start_ix..] {
|
||||
if range.start.cmp(&end, &buffer).is_ge() {
|
||||
if range.start.cmp(&end, buffer).is_ge() {
|
||||
break;
|
||||
}
|
||||
|
||||
highlight_endpoints.push(HighlightEndpoint {
|
||||
offset: range.start.to_offset(&buffer),
|
||||
offset: range.start.to_offset(buffer),
|
||||
is_start: true,
|
||||
tag,
|
||||
style,
|
||||
});
|
||||
highlight_endpoints.push(HighlightEndpoint {
|
||||
offset: range.end.to_offset(&buffer),
|
||||
offset: range.end.to_offset(buffer),
|
||||
is_start: false,
|
||||
tag,
|
||||
style,
|
||||
|
||||
@@ -36,8 +36,8 @@ pub fn is_invisible(c: char) -> bool {
|
||||
} else if c >= '\u{7f}' {
|
||||
c <= '\u{9f}'
|
||||
|| (c.is_whitespace() && c != IDEOGRAPHIC_SPACE)
|
||||
|| contains(c, &FORMAT)
|
||||
|| contains(c, &OTHER)
|
||||
|| contains(c, FORMAT)
|
||||
|| contains(c, OTHER)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
@@ -50,7 +50,7 @@ pub fn replacement(c: char) -> Option<&'static str> {
|
||||
Some(C0_SYMBOLS[c as usize])
|
||||
} else if c == '\x7f' {
|
||||
Some(DEL)
|
||||
} else if contains(c, &PRESERVE) {
|
||||
} else if contains(c, PRESERVE) {
|
||||
None
|
||||
} else {
|
||||
Some("\u{2007}") // fixed width space
|
||||
|
||||
@@ -1461,7 +1461,7 @@ mod tests {
|
||||
}
|
||||
|
||||
let mut prev_ix = 0;
|
||||
for boundary in line_wrapper.wrap_line(&[LineFragment::text(&line)], wrap_width) {
|
||||
for boundary in line_wrapper.wrap_line(&[LineFragment::text(line)], wrap_width) {
|
||||
wrapped_text.push_str(&line[prev_ix..boundary.ix]);
|
||||
wrapped_text.push('\n');
|
||||
wrapped_text.push_str(&" ".repeat(boundary.next_indent as usize));
|
||||
|
||||
Reference in New Issue
Block a user