Skip to content

Commit fcec932

Browse files
Fix tree-wide clippy lints
Signed-off-by: Christoph Heiss <[email protected]>
1 parent 7bd1e8d commit fcec932

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/commands/buffer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn save(app: &mut Application) -> Result {
2222
.path
2323
.clone(); // clone instead of borrow as we call another command later
2424

25-
if path.is_some() {
25+
if let Some(path) = path {
2626
// Save the buffer.
2727
app.workspace
2828
.current_buffer
@@ -32,7 +32,7 @@ pub fn save(app: &mut Application) -> Result {
3232
.chain_err(|| BUFFER_SAVE_FAILED)?;
3333

3434
// Run the format command if one is defined.
35-
if app.preferences.borrow().format_on_save(&path.unwrap()) {
35+
if app.preferences.borrow().format_on_save(&path) {
3636
format(app)?;
3737

3838
// Save the buffer again. We intentionally save twice because we
@@ -914,7 +914,7 @@ pub fn insert_tab(app: &mut Application) -> Result {
914914
.ok_or(BUFFER_MISSING)?;
915915
let tab_content = app.preferences.borrow().tab_content(buffer.path.as_ref());
916916
let tab_content_width = tab_content.chars().count();
917-
buffer.insert(tab_content.clone());
917+
buffer.insert(tab_content);
918918

919919
// Move the cursor to the end of the inserted content.
920920
for _ in 0..tab_content_width {

src/commands/selection.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn copy_to_clipboard(app: &mut Application) -> Result {
6363
let selected_range = Range::new(cursor_position, select_mode.anchor);
6464

6565
let data = buffer
66-
.read(&selected_range.clone())
66+
.read(&selected_range)
6767
.ok_or("Couldn't read selected data from buffer")?;
6868
app.clipboard.set_content(ClipboardContent::Inline(data))?;
6969
}
@@ -72,7 +72,7 @@ fn copy_to_clipboard(app: &mut Application) -> Result {
7272
util::inclusive_range(&LineRange::new(mode.anchor, buffer.cursor.line), buffer);
7373

7474
let data = buffer
75-
.read(&selected_range.clone())
75+
.read(&selected_range)
7676
.ok_or("Couldn't read selected data from buffer")?;
7777
app.clipboard.set_content(ClipboardContent::Block(data))?;
7878
}

src/input/key_map/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl KeyMap {
6666
let default_keymap_data = YamlLoader::load_from_str(KeyMap::default_data())
6767
.chain_err(|| "Couldn't parse default keymap")?
6868
.into_iter()
69-
.nth(0)
69+
.next()
7070
.ok_or("Couldn't locate a document in the default keymap")?;
7171

7272
KeyMap::from(default_keymap_data.as_hash().unwrap())

src/models/application/clipboard.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ impl Clipboard {
7777
};
7878

7979
// Update the in-app clipboard if we've found newer content.
80-
if new_content.is_some() {
81-
self.content = new_content.unwrap();
80+
if let Some(new_content) = new_content {
81+
self.content = new_content;
8282
}
8383

8484
&self.content

0 commit comments

Comments
 (0)