Skip to content

Commit 8d5a3d3

Browse files
authored
Merge pull request #3 from qezz/fix-clippy
Fix clippy warnings
2 parents 23694ab + 6bfdb54 commit 8d5a3d3

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

zee-grammar/src/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(crate) fn load_grammar(grammar_id: String) -> Result<Grammar> {
3838

3939
fn load_query(language: Language, grammar_id: &str, name: &str) -> Result<Query> {
4040
let query_path = tree_sitter_query_dir(grammar_id)
41-
.map(|path| path.join(&format!("{}.scm", name)))
41+
.map(|path| path.join(format!("{}.scm", name)))
4242
.with_context(|| {
4343
format!(
4444
"Failed to build path to query grammar_id={} name={}",
@@ -212,7 +212,7 @@ fn build_tree_sitter_library(grammar_id: &str, paths: &TreeSitterPaths) -> Resul
212212
if cfg!(windows) {
213213
command.arg(&paths.parser);
214214
if let Some(TreeSitterScannerSource { ref path, .. }) = paths.scanner {
215-
command.arg(&path);
215+
command.arg(path);
216216
}
217217
command.arg(format!("/out:{}", library_path.to_str().unwrap()));
218218
} else {
@@ -323,7 +323,7 @@ impl TreeSitterPaths {
323323
fn tree_sitter_source_dir(grammar_id: &str) -> Result<PathBuf> {
324324
Ok(config::config_dir()?
325325
.join(BUILD_DIR)
326-
.join(&format!("tree-sitter-{}", grammar_id)))
326+
.join(format!("tree-sitter-{}", grammar_id)))
327327
}
328328

329329
fn tree_sitter_query_dir(grammar_id: &str) -> Result<PathBuf> {

zee/src/components/buffer/line_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Component for LineInfo {
4949
for line_index in 0..frame.size.height {
5050
canvas.draw_str(
5151
0,
52-
line_index as usize,
52+
line_index,
5353
style,
5454
if line_offset + line_index < num_lines {
5555
" "

zee/src/components/edit_tree_viewer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl Component for EditTreeViewer {
124124
}
125125
let mut pairs = revision.children.windows(2);
126126

127-
while let Some(&[ref left, ref right]) = pairs.next() {
127+
while let Some([left, right]) = pairs.next() {
128128
let formatted_left = &formatted_tree[left.index];
129129
let formatted_right = &formatted_tree[right.index];
130130
assert!(formatted_left.transform.y == formatted_right.transform.y);

zee/src/components/prompt/buffers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl Component for BufferPicker {
216216
.path
217217
.as_ref()
218218
.map(|entry| format!(" {}", entry.display()))
219-
.unwrap_or_else(String::new),
219+
.unwrap_or_default(),
220220
)
221221
.style(Style::normal(background, theme.file_size)),
222222
),

zee/src/components/prompt/picker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ where
404404
listing.reset(
405405
files_iter(path_str.clone())?.take(MAX_FILES_IN_PICKER),
406406
&path_str,
407-
&prefix,
407+
prefix,
408408
);
409409
} else {
410410
listing.set_filter(&path_str)

zee/src/components/prompt/status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl Component for Status {
6767
};
6868
Text::with(
6969
TextProperties::new()
70-
.content(action_name.to_owned())
70+
.content(action_name.clone())
7171
.style(style),
7272
)
7373
}

zee/src/editor/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl Buffer {
252252
pub fn new_cursor(&mut self) -> CursorId {
253253
let new_cursor_id = CursorId(self.cursors.len());
254254
self.cursors
255-
.push(self.cursors.get(0).cloned().unwrap_or_else(Cursor::new));
255+
.push(self.cursors.first().cloned().unwrap_or_else(Cursor::new));
256256
new_cursor_id
257257
}
258258

zee/src/editor/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ impl Component for Editor {
476476
Some(NamedBindingQuery::PrefixOf(mut lhs)),
477477
Some(NamedBindingQuery::PrefixOf(rhs)),
478478
) => {
479-
lhs.extend(rhs.into_iter());
479+
lhs.extend(rhs);
480480
Some(NamedBindingQuery::PrefixOf(lhs))
481481
}
482482
(some @ Some(_), None) | (None, some @ Some(_)) => some,

0 commit comments

Comments
 (0)