diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-04-29 18:22:44 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-04-30 11:05:47 -0400 |
commit | 36d8299f224b044139d52c0f65eb66be4c25a5d0 (patch) | |
tree | 5f99fdfff153ab9f39c1d3ed77f9f18ef3c2d5d3 /src/commands/open_file.rs | |
parent | 4bbe0969006eab7cfe3a47231d5e002b5259e19b (diff) |
cargo clippy
Diffstat (limited to 'src/commands/open_file.rs')
-rw-r--r-- | src/commands/open_file.rs | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/commands/open_file.rs b/src/commands/open_file.rs index bac4cdd..bf4d751 100644 --- a/src/commands/open_file.rs +++ b/src/commands/open_file.rs @@ -35,20 +35,25 @@ impl OpenFile { } } } - let mimetype_str = tree_magic::from_filepath(&path); - - /* mime subtype have second priority */ - if let Some(s) = MIMETYPE_T.mimetype.get(&mimetype_str) { - mimetype_options.extend(s.iter()); - } +/* + match tree_magic::from_filepath(&path) { + None => {}, + Some(mimetype) => { + /* mime subtype have second priority */ + if let Some(s) = MIMETYPE_T.mimetype.get(&mimetype) { + mimetype_options.extend(s.iter()); + } - /* generic mime type have last priority */ - if let Some(s) = mimetype_str.find('/') { - let mimetype_type = &mimetype_str[..s]; - if let Some(s) = MIMETYPE_T.mimetype.get(mimetype_type) { - mimetype_options.extend(s.iter()); + /* generic mime type have last priority */ + if let Some(s) = mimetype.find('/') { + let mimetype_type = &mimetype[..s]; + if let Some(s) = MIMETYPE_T.mimetype.get(mimetype_type) { + mimetype_options.extend(s.iter()); + } + } } } +*/ mimetype_options } @@ -118,7 +123,7 @@ impl OpenFile { .history .insert(new_curr_list.path.clone(), new_curr_list); - curr_tab.curr_path = path.clone().to_path_buf(); + curr_tab.curr_path = path.to_path_buf().clone(); Ok(()) } |