Skip to content

Commit

Permalink
Merge pull request #3 from qezz/fix-clippy
Browse files Browse the repository at this point in the history
Fix clippy warnings
  • Loading branch information
qezz authored Jun 10, 2024
2 parents 23694ab + 6bfdb54 commit 8d5a3d3
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions zee-grammar/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(crate) fn load_grammar(grammar_id: String) -> Result<Grammar> {

fn load_query(language: Language, grammar_id: &str, name: &str) -> Result<Query> {
let query_path = tree_sitter_query_dir(grammar_id)
.map(|path| path.join(&format!("{}.scm", name)))
.map(|path| path.join(format!("{}.scm", name)))
.with_context(|| {
format!(
"Failed to build path to query grammar_id={} name={}",
Expand Down Expand Up @@ -212,7 +212,7 @@ fn build_tree_sitter_library(grammar_id: &str, paths: &TreeSitterPaths) -> Resul
if cfg!(windows) {
command.arg(&paths.parser);
if let Some(TreeSitterScannerSource { ref path, .. }) = paths.scanner {
command.arg(&path);
command.arg(path);
}
command.arg(format!("/out:{}", library_path.to_str().unwrap()));
} else {
Expand Down Expand Up @@ -323,7 +323,7 @@ impl TreeSitterPaths {
fn tree_sitter_source_dir(grammar_id: &str) -> Result<PathBuf> {
Ok(config::config_dir()?
.join(BUILD_DIR)
.join(&format!("tree-sitter-{}", grammar_id)))
.join(format!("tree-sitter-{}", grammar_id)))
}

fn tree_sitter_query_dir(grammar_id: &str) -> Result<PathBuf> {
Expand Down
2 changes: 1 addition & 1 deletion zee/src/components/buffer/line_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Component for LineInfo {
for line_index in 0..frame.size.height {
canvas.draw_str(
0,
line_index as usize,
line_index,
style,
if line_offset + line_index < num_lines {
" "
Expand Down
2 changes: 1 addition & 1 deletion zee/src/components/edit_tree_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl Component for EditTreeViewer {
}
let mut pairs = revision.children.windows(2);

while let Some(&[ref left, ref right]) = pairs.next() {
while let Some([left, right]) = pairs.next() {
let formatted_left = &formatted_tree[left.index];
let formatted_right = &formatted_tree[right.index];
assert!(formatted_left.transform.y == formatted_right.transform.y);
Expand Down
2 changes: 1 addition & 1 deletion zee/src/components/prompt/buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl Component for BufferPicker {
.path
.as_ref()
.map(|entry| format!(" {}", entry.display()))
.unwrap_or_else(String::new),
.unwrap_or_default(),
)
.style(Style::normal(background, theme.file_size)),
),
Expand Down
2 changes: 1 addition & 1 deletion zee/src/components/prompt/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ where
listing.reset(
files_iter(path_str.clone())?.take(MAX_FILES_IN_PICKER),
&path_str,
&prefix,
prefix,
);
} else {
listing.set_filter(&path_str)
Expand Down
2 changes: 1 addition & 1 deletion zee/src/components/prompt/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Component for Status {
};
Text::with(
TextProperties::new()
.content(action_name.to_owned())
.content(action_name.clone())
.style(style),
)
}
Expand Down
2 changes: 1 addition & 1 deletion zee/src/editor/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl Buffer {
pub fn new_cursor(&mut self) -> CursorId {
let new_cursor_id = CursorId(self.cursors.len());
self.cursors
.push(self.cursors.get(0).cloned().unwrap_or_else(Cursor::new));
.push(self.cursors.first().cloned().unwrap_or_else(Cursor::new));
new_cursor_id
}

Expand Down
2 changes: 1 addition & 1 deletion zee/src/editor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ impl Component for Editor {
Some(NamedBindingQuery::PrefixOf(mut lhs)),
Some(NamedBindingQuery::PrefixOf(rhs)),
) => {
lhs.extend(rhs.into_iter());
lhs.extend(rhs);
Some(NamedBindingQuery::PrefixOf(lhs))
}
(some @ Some(_), None) | (None, some @ Some(_)) => some,
Expand Down

0 comments on commit 8d5a3d3

Please sign in to comment.