drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

subcommand `config` exits with error

KuabeM opened this issue · comments

Describe the bug

Running cargo spellcheck config --stdout throws an error:

Error:
   0: Failed to convert to toml
   1: values must be emitted before tables

Location:
   src/config/mod.rs:145

The error messages hints that there is something wrong with the config struct. I'll investigate further which part is responsible.

To Reproduce

Steps to reproduce the behaviour:

  1. checkout master
  2. Run cargo spellcheck config --stdout (or --user)
  3. Spellcheck fails with an error

Expected behavior

Prints default config on stdout.

Screenshots

Please complete the following information:

  • System: Arch linux
  • Obtained: cargo
  • Version: current master, git bisect shows that the error was introduced in either 94dcfa8 or 6b9d09f (the latter one doesn't compile with rust-1.54 on my machine)

Additional context

Here is the output of running with high verbosity. Backtrace does not contain much information, so I skipped it.

cargo r -- config --stdout -vvvvvv
   Compiling cargo-spellcheck v0.9.0-rc1 (/home/korbinian/RustProjects/cargo-spellcheck)
    Finished dev [unoptimized + debuginfo] target(s) in 9.20s
     Running `target/debug/cargo-spellcheck config --stdout -vvvvvv`
[2021-10-27T20:54:10Z TRACE cargo_spellcheck::config::args] Derived action Config from flags/args/cmds
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config::args] Attempting to load configuration by priority.
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config::args] No cfg flag present
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config::args] Using /home/korbinian/RustProjects/cargo-spellcheck/Cargo.toml manifest as anchor file
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config::args] Using configuration file /home/korbinian/RustProjects/cargo-spellcheck/.config/spellcheck.toml
[2021-10-27T20:54:10Z TRACE cargo_spellcheck::config::hunspell] Sanitized (/home/korbinian/RustProjects/cargo-spellcheck/.config + .) -> /home/korbinian/RustProjects/cargo-spellcheck/.config
[2021-10-27T20:54:10Z TRACE cargo_spellcheck::config::args] Derived action Config from flags/args/cmds
[2021-10-27T20:54:10Z TRACE cargo_spellcheck] Configuration chore
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config] Config { dev_comments: false, skip_readme: false, hunspell: Some(HunspellConfig { lang: Lang5 { lang: eng, country: US }, search_dirs: SearchDirs([]), skip_os_lookups: false, use_builtin: true, extra_dictionaries: [], quirks: Quirks { transform_regex: [], allow_concatenation: false, allow_dashes: false, allow_emojis: true }, tokenization_splitchars: "\",;:.!?#(){}[]|/_-‒'`&@§¶…" }), nlprules: Some(NlpRulesConfig { override_rules: None, override_tokenizer: None }), reflow: Some(ReflowConfig { max_line_length: 80 }) }
Error:
   0: Failed to convert to toml
   1: values must be emitted before tables

Location:
   src/config/mod.rs:146

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Since I can't reproduce it, could you run with RUST_BACKTRACE=full?

Weird that everything worked fine on your side.. for me it was also broken on Ubuntu 20.04 with rust 1.54 and 1.56..

I think I mixed up two issues, so I could reproduce it.