quicli icon indicating copy to clipboard operation
quicli copied to clipboard

Move Result type out of the prelude

Open mistydemeo opened this issue 6 years ago • 2 comments

The Result type exposed by quicli::prelude conflicts with the Result type that's in the default Rust namespace, since it has a different type signature. This makes it inconvenient to drop quicli into existing projects. It'd be great to move this out of the prelude and make it an optional import instead.

For example, here's a PR where I'm switching from bare clap to quicli. I ended up tossing a use std::result::Result right after the quicli prelude import, which is the kind of thing which makes me think this should work the other way around.

mistydemeo avatar Feb 19 '18 06:02 mistydemeo

Yeah, I regret adding it to the prelude in retrospect. In addition to your case with existing code, error handling is one of the less obvious things to many people coming to Rust from other languages, so this is also needlessly confusing them further.

I imagine fix here that is two-fold. First:

  • [ ] Change the name of the type alias to QuickResult (or something like that, feel free to bikeshed)
  • [ ] Document this type alias thoroughly

And then:

  • [ ] Write a guide that covers error handling in more detail (and that also links to failure's docs)

killercup avatar Feb 19 '18 07:02 killercup

Change the name of the type alias to QuickResult (or something like that, feel free to bikeshed)

I'd also really like to see it moved out of the prelude and made into an optional import. Compared to the other items in the prelude, it's much more tenuously connected to this crate's main features.

mistydemeo avatar Feb 20 '18 06:02 mistydemeo