Commit fcec932 1 parent 7bd1e8d commit fcec932 Copy full SHA for fcec932
File tree 4 files changed +8
-8
lines changed
4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ pub fn save(app: &mut Application) -> Result {
22
22
. path
23
23
. clone ( ) ; // clone instead of borrow as we call another command later
24
24
25
- if path . is_some ( ) {
25
+ if let Some ( path ) = path {
26
26
// Save the buffer.
27
27
app. workspace
28
28
. current_buffer
@@ -32,7 +32,7 @@ pub fn save(app: &mut Application) -> Result {
32
32
. chain_err ( || BUFFER_SAVE_FAILED ) ?;
33
33
34
34
// 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) {
36
36
format ( app) ?;
37
37
38
38
// Save the buffer again. We intentionally save twice because we
@@ -914,7 +914,7 @@ pub fn insert_tab(app: &mut Application) -> Result {
914
914
. ok_or ( BUFFER_MISSING ) ?;
915
915
let tab_content = app. preferences . borrow ( ) . tab_content ( buffer. path . as_ref ( ) ) ;
916
916
let tab_content_width = tab_content. chars ( ) . count ( ) ;
917
- buffer. insert ( tab_content. clone ( ) ) ;
917
+ buffer. insert ( tab_content) ;
918
918
919
919
// Move the cursor to the end of the inserted content.
920
920
for _ in 0 ..tab_content_width {
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ fn copy_to_clipboard(app: &mut Application) -> Result {
63
63
let selected_range = Range :: new ( cursor_position, select_mode. anchor ) ;
64
64
65
65
let data = buffer
66
- . read ( & selected_range. clone ( ) )
66
+ . read ( & selected_range)
67
67
. ok_or ( "Couldn't read selected data from buffer" ) ?;
68
68
app. clipboard . set_content ( ClipboardContent :: Inline ( data) ) ?;
69
69
}
@@ -72,7 +72,7 @@ fn copy_to_clipboard(app: &mut Application) -> Result {
72
72
util:: inclusive_range ( & LineRange :: new ( mode. anchor , buffer. cursor . line ) , buffer) ;
73
73
74
74
let data = buffer
75
- . read ( & selected_range. clone ( ) )
75
+ . read ( & selected_range)
76
76
. ok_or ( "Couldn't read selected data from buffer" ) ?;
77
77
app. clipboard . set_content ( ClipboardContent :: Block ( data) ) ?;
78
78
}
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ impl KeyMap {
66
66
let default_keymap_data = YamlLoader :: load_from_str ( KeyMap :: default_data ( ) )
67
67
. chain_err ( || "Couldn't parse default keymap" ) ?
68
68
. into_iter ( )
69
- . nth ( 0 )
69
+ . next ( )
70
70
. ok_or ( "Couldn't locate a document in the default keymap" ) ?;
71
71
72
72
KeyMap :: from ( default_keymap_data. as_hash ( ) . unwrap ( ) )
Original file line number Diff line number Diff line change @@ -77,8 +77,8 @@ impl Clipboard {
77
77
} ;
78
78
79
79
// 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;
82
82
}
83
83
84
84
& self . content
You can’t perform that action at this time.
0 commit comments