Skip to content

Commit

Permalink
fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
panekj committed Aug 16, 2024
1 parent 85ac3b4 commit 89779ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/taplo-cli/src/commands/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tokio::io::{AsyncReadExt, AsyncWriteExt};

impl<E: Environment> Taplo<E> {
pub async fn execute_format(&mut self, cmd: FormatCommand) -> Result<(), anyhow::Error> {
if matches!(cmd.files.get(0).map(|it| it.as_str()), Some("-")) {
if matches!(cmd.files.first().map(|it| it.as_str()), Some("-")) {
self.format_stdin(cmd).await
} else {
self.format_files(cmd).await
Expand Down
2 changes: 1 addition & 1 deletion crates/taplo-common/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub mod builtins {

#[must_use]
pub fn taplo_config_schema() -> Arc<Value> {
Arc::new(serde_json::to_value(&schemars::schema_for!(crate::config::Config)).unwrap())
Arc::new(serde_json::to_value(schemars::schema_for!(crate::config::Config)).unwrap())
}

#[must_use]
Expand Down
6 changes: 3 additions & 3 deletions crates/taplo/src/dom/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl Node {
pub fn get_matches(
&self,
pattern: &str,
) -> Result<impl Iterator<Item = (KeyOrIndex, Node)> + ExactSizeIterator, Error> {
) -> Result<impl ExactSizeIterator<Item = (KeyOrIndex, Node)>, Error> {
let glob = globset::Glob::new(pattern)
.map_err(QueryError::from)?
.compile_matcher();
Expand All @@ -132,7 +132,7 @@ impl Node {
Node::Array(arr) => {
let items = arr.items().read();
for (idx, node) in items.iter().enumerate() {
if glob.is_match(&idx.to_string()) {
if glob.is_match(idx.to_string()) {
matched.push((KeyOrIndex::from(idx), node.clone()));
}
}
Expand Down Expand Up @@ -211,7 +211,7 @@ impl Node {
}
}
KeyOrIndex::Index(idx) => {
if !glob.is_match(&idx.to_string()) {
if !glob.is_match(idx.to_string()) {
return false;
}
}
Expand Down

0 comments on commit 89779ab

Please sign in to comment.