chore: misc clippy lints
This commit is contained in:
parent
50bea73ce3
commit
5c6445edea
22 changed files with 74 additions and 72 deletions
|
|
@ -273,13 +273,13 @@ impl std::fmt::Display for Pattern {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tree> PartialOrd for Match<'a, 'tree> {
|
||||
impl PartialOrd for Match<'_, '_> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tree> Ord for Match<'a, 'tree> {
|
||||
impl Ord for Match<'_, '_> {
|
||||
// Tree-sitter returns matches in the order that they terminate
|
||||
// during a depth-first walk of the tree. If multiple matches
|
||||
// terminate on the same node, those matches are produced in the
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ fn test_parsing_with_custom_utf16le_input() {
|
|||
|
||||
let lines = ["pub fn foo() {", " 1", "}"]
|
||||
.iter()
|
||||
.map(|s| s.encode_utf16().map(|u| u.to_le()).collect::<Vec<_>>())
|
||||
.map(|s| s.encode_utf16().map(u16::to_le).collect::<Vec<_>>())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let newline = [('\n' as u16).to_le()];
|
||||
|
|
@ -267,7 +267,7 @@ fn test_parsing_text_with_byte_order_mark() {
|
|||
.parse_utf16_le(
|
||||
"\u{FEFF}fn a() {}"
|
||||
.encode_utf16()
|
||||
.map(|u| u.to_le())
|
||||
.map(u16::to_le)
|
||||
.collect::<Vec<_>>(),
|
||||
None,
|
||||
)
|
||||
|
|
@ -1134,7 +1134,7 @@ fn test_parsing_utf16_code_with_errors_at_the_end_of_an_included_range() {
|
|||
let source_code = "<script>a.</script>";
|
||||
let utf16_source_code = source_code
|
||||
.encode_utf16()
|
||||
.map(|u| u.to_le())
|
||||
.map(u16::to_le)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let start_byte = 2 * source_code.find("a.").unwrap();
|
||||
|
|
|
|||
|
|
@ -3488,10 +3488,10 @@ fn test_query_captures_with_matches_removed() {
|
|||
|
||||
let mut captures = cursor.captures(&query, tree.root_node(), source.as_bytes());
|
||||
while let Some((m, i)) = captures.next() {
|
||||
println!("captured: {:?}, {}", m, i);
|
||||
println!("captured: {m:?}, {i}");
|
||||
let capture = m.captures[*i];
|
||||
let text = capture.node.utf8_text(source.as_bytes()).unwrap();
|
||||
println!("captured: {:?}", text);
|
||||
println!("captured: {text:?}");
|
||||
if text == "a" {
|
||||
m.remove();
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -705,11 +705,11 @@ fn test_consistency_with_mid_codepoint_edit() {
|
|||
|
||||
#[test]
|
||||
fn test_tree_cursor_on_aliased_root_with_extra_child() {
|
||||
let source = r#"
|
||||
let source = r"
|
||||
fn main() {
|
||||
C/* hi */::<D>::E;
|
||||
}
|
||||
"#;
|
||||
";
|
||||
|
||||
let mut parser = Parser::new();
|
||||
parser.set_language(&get_language("rust")).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue