Skip to content

Commit

Permalink
Fix tree-wide clippy lints
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
  • Loading branch information
christoph-heiss committed Apr 3, 2024
1 parent 7bd1e8d commit fcec932
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/commands/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn save(app: &mut Application) -> Result {
.path
.clone(); // clone instead of borrow as we call another command later

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

// Run the format command if one is defined.
if app.preferences.borrow().format_on_save(&path.unwrap()) {
if app.preferences.borrow().format_on_save(&path) {
format(app)?;

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

// Move the cursor to the end of the inserted content.
for _ in 0..tab_content_width {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn copy_to_clipboard(app: &mut Application) -> Result {
let selected_range = Range::new(cursor_position, select_mode.anchor);

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

let data = buffer
.read(&selected_range.clone())
.read(&selected_range)
.ok_or("Couldn't read selected data from buffer")?;
app.clipboard.set_content(ClipboardContent::Block(data))?;
}
Expand Down
2 changes: 1 addition & 1 deletion src/input/key_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl KeyMap {
let default_keymap_data = YamlLoader::load_from_str(KeyMap::default_data())
.chain_err(|| "Couldn't parse default keymap")?
.into_iter()
.nth(0)
.next()
.ok_or("Couldn't locate a document in the default keymap")?;

KeyMap::from(default_keymap_data.as_hash().unwrap())
Expand Down
4 changes: 2 additions & 2 deletions src/models/application/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl Clipboard {
};

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

&self.content
Expand Down

0 comments on commit fcec932

Please sign in to comment.