Skip to content

zb,zm,zd: Remove redundant Result wrapping of return values

Zeeshan Ali Khan requested to merge rm-result-wrap into master

Fixes new clippy warning:

error: this function's return value is unnecessarily wrapped by `Result`
  --> zvariant_derive/src/utils.rs:29:1
   |
29 | / fn parse_attribute(meta: &NestedMeta) -> Result<(String, String)> {
30 | |     let meta = match &meta {
31 | |         NestedMeta::Meta(m) => m,
32 | |         _ => panic!("wrong meta type"),
...  |
49 | |     Ok((ident.to_string(), value))
50 | | }
   | |_^
   |
   = note: `-D clippy::unnecessary-wraps` implied by `-D warnings`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove `Result` from the return type...
   |
29 | fn parse_attribute(meta: &NestedMeta) -> (std::string::String, std::string::String) {
   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: ...and change the returning expressions
   |
35 |         Meta::Path(p) => return (p.get_ident().unwrap().to_string(), "".to_string()),
36 |         Meta::NameValue(n) => n,
37 |         _ => panic!("wrong meta type"),
38 |     };
39 |     let value = match &meta.lit {
40 |         Lit::Str(s) => s.value(),

Merge request reports