Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win32yank updates #10

Merged
merged 6 commits into from
Sep 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove try macros, mark as rust 2018
  • Loading branch information
equalsraf committed Sep 12, 2021
commit cccc457c9952a0d772cf2c6093054b1a9b1a251b
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "win32yank"
version = "0.1.0"
authors = ["raf"]
edition = "2018"

[dependencies]
docopt = "1.1.0"
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn from_wide_ptr(ptr: *const u16) -> String {

fn get_clipboard(replace_crlf: bool) -> Result<String, WindowsError> {
let result: Result<String, WindowsError>;
try!(open_clipboard());
open_clipboard()?;

// Check clipboard contents, return empty string if unicode text
// is not available
Expand All @@ -80,7 +80,7 @@ fn get_clipboard(replace_crlf: bool) -> Result<String, WindowsError> {
GlobalUnlock(text_handler);
}
}
try!(close_clipboard());
close_clipboard()?;

if replace_crlf {
result.map(|data| data.replace("\r\n", "\n"))
Expand Down