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

Shouldn't failure conditions return Err? #94

Open
AeriaVelocity opened this issue Sep 28, 2023 · 0 comments
Open

Shouldn't failure conditions return Err? #94

AeriaVelocity opened this issue Sep 28, 2023 · 0 comments

Comments

@AeriaVelocity
Copy link

I looked at the source for nop_clipboard.rs, and this doesn't seem right:

impl ClipboardProvider for NopClipboardContext {
    fn new() -> Result<NopClipboardContext, Box<Error>> {
        Ok(NopClipboardContext)
    }
    fn get_contents(&mut self) -> Result<String, Box<Error>> {
        println!("Attempting to get the contents of the clipboard, which hasn't yet been \
                  implemented on this platform.");
        Ok("".to_string())
    }
    fn set_contents(&mut self, _: String) -> Result<(), Box<Error>> {
        println!("Attempting to set the contents of the clipboard, which hasn't yet been \
                  implemented on this platform.");
        Ok(())
    }
}

Shouldn't this return Err, not Ok? It's kind of a pain to deal with an error condition that indicates success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant