Julien-cpsn / ATAC

A simple API client (postman like) in your terminal
https://atac.julien-cpsn.com/
MIT License
1.86k stars 81 forks source link

non-exhaustive patterns: `Language::Javascript` not covered #39

Closed HamzaMateen closed 5 months ago

HamzaMateen commented 5 months ago

after running:

cargo install atac

to install ATAC, I face this error:

in /postman.rs:278:50
    |
278 |                         let request_body = match language {
    |                                                  ^^^^^^^^ pattern `Language::Javascript` not covered
    |
note: `Language` defined here
/mod.rs:448:1
    |
448 | pub enum Language {
    | ^^^^^^^^^^^^^^^^^
...
462 |     Javascript,
    |     ---------- not covered
    = note: the matched value is of type `Language`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
282 ~                             Language::Xml => ContentType::Xml(body_as_raw),
283 +                             Language::Javascript => todo!()
    |

For more information about this error, try `rustc --explain E0004`.
error: could not compile `atac` (bin "atac") due to 1 previous error
error: failed to compile `atac v0.13.0`, intermediate artifacts can be found at `/tmp/cargo-installL1VJs5`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

but the source code actually has this match value for Language enum covered as can be seen: in /postman.rs

 return match body_mode {
                Mode::Raw => {
                    let body_as_raw = body.raw?;

                    if let Some(options) = body.options {
                        let language = options.raw?.language?;

                        let request_body = match language {
                            Language::Html => ContentType::Html(body_as_raw),
                            Language::Json => ContentType::Json(body_as_raw),
                            Language::Text => ContentType::Raw(body_as_raw),
                            Language::Xml => ContentType::Xml(body_as_raw),
                            Language::Javascript => ContentType::Javascript(body_as_raw),
                        };

                        Some(request_body)
                    } else {
                        Some(ContentType::Raw(body_as_raw))
                    }
                }

what seems to be the problem, can somebody explain this? Thanks

Julien-cpsn commented 5 months ago

Hello!

This temporary issue has been resolved in https://github.com/Julien-cpsn/ATAC/issues/35 TL;DR: cargo install atac@=0.13.0-bis

Have a great day