Skip to content

Commit

Permalink
Cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Erin van der Veen committed Jan 25, 2024
1 parent 02ffba3 commit f0e2e38
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 14 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions topiary-tree-sitter-facade/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,7 @@ mod native {

impl<'a> PartialOrd for Node<'a> {
fn partial_cmp(&self, that: &Node<'a>) -> Option<std::cmp::Ordering> {
let this = self.id();
let that = that.id();
this.partial_cmp(&that)
Some(self.cmp(that))
}
}

Expand Down
2 changes: 1 addition & 1 deletion topiary-tree-sitter-facade/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ mod native {
}

#[inline]
pub fn disable_pattern(&mut self, index: usize) -> () {
pub fn disable_pattern(&mut self, index: usize) {
self.inner.disable_pattern(index)
}

Expand Down
12 changes: 3 additions & 9 deletions topiary-web-tree-sitter-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::unused_unit)]

// FIXME: Double check we construct object properties in order.

use core::cell::RefCell;
Expand Down Expand Up @@ -77,7 +75,7 @@ impl TreeSitter {

let scope = &web_sys::window().unwrap_throw();

let tree_sitter = Reflect::get(&scope, &"TreeSitter".into()).and_then(|property| {
let tree_sitter = Reflect::get(scope, &"TreeSitter".into()).and_then(|property| {
if property.is_undefined() {
let message = "window.TreeSitter is not defined; load the tree-sitter javascript module first";
Err(JsError::new(message).into())
Expand Down Expand Up @@ -374,9 +372,7 @@ impl PartialEq for Point {

impl PartialOrd for Point {
fn partial_cmp(&self, that: &Point) -> Option<std::cmp::Ordering> {
let this = self.spread();
let that = that.spread();
this.partial_cmp(&that)
Some(self.cmp(that))
}
}

Expand Down Expand Up @@ -652,9 +648,7 @@ impl PartialEq<Range> for Range {

impl PartialOrd<Range> for Range {
fn partial_cmp(&self, that: &Self) -> Option<std::cmp::Ordering> {
let this = self.spread();
let that = that.spread();
this.partial_cmp(&that)
Some(self.cmp(that))
}
}

Expand Down
1 change: 1 addition & 0 deletions topiary/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ env_logger = { workspace = true }
test-log = { workspace = true }
tokio-test = { workspace = true }
tree-sitter-json.workspace = true
tree-sitter-ocaml.workspace = true

[[bench]]
name = "benchmark"
Expand Down
2 changes: 1 addition & 1 deletion topiary/src/atom_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ impl AtomCollection {
{
opened_scopes
.entry(scope_id)
.or_insert_with(Vec::new)
.or_default()
.push((*line_start, Vec::new()));
} else if let Atom::ScopeEnd(ScopeInformation {
line_number: line_end,
Expand Down

0 comments on commit f0e2e38

Please sign in to comment.