toyboot4e / adbook

Dead-simple SSG powered by Asciidoctor
https://toyboot4e.github.io/adbook/
MIT License
7 stars 2 forks source link

cargo install fails on windows #7

Closed Mazwak closed 2 years ago

Mazwak commented 2 years ago

I tried to use adbook, but it does not install.

I’m using rust 1.57.0.

I also cloned the repo, but it fails too.

There are many errors, but it’s just a few repeated :

error: cannot find derive macro `Parser` in this scope
  --> src\cli.rs:33:10
   |
33 | #[derive(Parser, Debug)]
   |          ^^^^^^
   |
note: `Parser` is imported here, but it is only a trait, without a derive macro
  --> src\cli.rs:27:5
   |
27 | use clap::Parser;
   |     ^^^^^^^^^^^^

error: cannot find attribute `clap` in this scope
  --> src\cli.rs:34:3
   |
34 | #[clap(name = "adbook is a simple SSG powered by asciidoctor")]
   |   ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

A problem with clap. It just needs the « derive » feature in cargo.toml.

A confusion for the compiler between the various « Ok ».

Mazwak commented 2 years ago

Forgot some logs.

error[E0532]: expected tuple struct or tuple variant, found function `Ok`
   --> src\build\convert\adoc.rs:373:17
    |
373 |                 Ok(name) => name.trim(),
    |                 ^^ not a tuple struct or tuple variant
    |
help: consider importing one of these items instead
    |
5   | use serde::__private::Ok;
    |
5   | use std::result::Result::Ok;
    |
5   | use core::result::Result::Ok;
toyboot4e commented 2 years ago

OMG, it was broken! Fixed it, thank you <3

Mazwak commented 2 years ago

rustc is still confused with 'Ok'.

I replaced all occurences with core::result::Result::Ok, and it compiled. It seems to work fine also.

toyboot4e commented 2 years ago

I fixed it by not importing Ok from anyhow. Then Rust is smart enough to find the corresponding Result :) I wonder if anyhow::Ok is nonsense.

Also I need to figure out why it didn't happen on my mac.