Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA is bad at completing rustdoc lints #8349

Closed
jyn514 opened this issue Apr 5, 2021 · 6 comments
Closed

RA is bad at completing rustdoc lints #8349

jyn514 opened this issue Apr 5, 2021 · 6 comments
Labels
A-completion autocompletion S-actionable Someone could pick this issue up and work on it right now

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 5, 2021

This is a couple different bug reports in one; let me know if you'd prefer I open more issues.

  1. Typing rustdoc:: resets the suggestions: https://drive.google.com/file/d/1lY7dDREBvyozmK0tSxYAFuO0ask7btfD/view?usp=sharing (this might just be #![allow(clippy:: incorrectly completes with a leading clippy:: #7144).
  2. Not all rustdoc lints seem to be supported? https://drive.google.com/file/d/1iXFox4VAckasntgoqti6Vzoh5Ndxgsu9/view?usp=sharing

For 2, I think rather than hard-coding the list of lints, RA should discover it from rustdoc itself with -W help (should hopefully be implemented on the next nightly: rust-lang/rust#83895. Then it will always be up to date and won't have to worry about renamed lints and that sort of thing.

@jonas-schievink jonas-schievink added A-completion autocompletion S-actionable Someone could pick this issue up and work on it right now labels Apr 5, 2021
@jyn514
Copy link
Member Author

jyn514 commented Apr 5, 2021

Unfortunately -Whelp doesn't seem to support JSON output :/ if that would be helpful to you I think it would be reasonable to add, I can make an MCP. Let me know.

The current output looks like this:

Available lint options:
    -W <foo>           Warn about <foo>
    -A <foo>           Allow <foo>
    -D <foo>           Deny <foo>
    -F <foo>           Forbid <foo> (deny <foo> and all attempts to override)


Lint checks provided by rustc:

                                                       name  default  meaning
                                                       ----  -------  -------
                     absolute-paths-not-starting-with-crate  allow    fully qualified paths that start with a module name instead of `crate`, `self`, or an extern crate name
                                       anonymous-parameters  allow    detects anonymous parameters
                                               box-pointers  allow    use of owned (Box type) heap memory
...
Lint groups provided by rustc:

                       name  sub-lints
                       ----  ---------
                   warnings  all lints that are set to issue warnings
        future-incompatible  keyword-idents, anonymous-parameters, forbidden-lint-groups, illegal-floating-point-literal-pattern, private-in-public, pub-use-of-private-extern-crate, invalid-type-param-default, const-err, unaligned-references, patterns-in-fns-without-body, missing-fragment-specifier, late-bound-lifetime-arguments, order-dependent-trait-objects, coherence-leak-check, tyvar-behind-raw-pointer, absolute-paths-not-starting-with-crate, unstable-name-collisions, where-clauses-object-safety, proc-macro-derive-resolution-fallback, macro-expanded-macro-exports-accessed-by-absolute-paths, ill-formed-attribute-input, conflicting-repr-hints, ambiguous-associated-items, mutable-borrow-reservation-conflict, indirect-structural-match, pointer-structural-match, nontrivial-structural-match, soft-unstable, cenum-impl-drop-cast, const-evaluatable-unchecked, uninhabited-static, unsupported-naked-functions, semicolon-in-expressions-from-macros, legacy-derive-helpers, proc-macro-back-compat, array-into-iter

Lint tools like Clippy can provide additional lints and lint groups.

@jyn514
Copy link
Member Author

jyn514 commented Apr 6, 2021

should hopefully be implemented on the next nightly: rust-lang/rust#83895

This has landed :)

@Veykril
Copy link
Member

Veykril commented Oct 18, 2021

Just tried rustdoc -W help to see its output but it does not work for me as it just gives me error: missing file operand.

@Veykril
Copy link
Member

Veykril commented Oct 18, 2021

Oh passing it a random file does make it work, that seems odd given rustc works without an input file for this.

Also is this supposed to also emit rustc lints? Would've expected to only see rustdoc lints by doing this.

@jyn514
Copy link
Member Author

jyn514 commented Oct 18, 2021

Just tried rustdoc -W help to see its output but it does not work for me as it just gives me error: missing file operand.

rust-lang/rust#88831

bors bot added a commit that referenced this issue Oct 20, 2021
10594: fix: Generate and complete rustdoc lints r=Veykril a=Veykril

Fixes #10572, #8349
bors r+

Co-authored-by: Lukas Wirth <[email protected]>
@Veykril
Copy link
Member

Veykril commented Oct 20, 2021

Fixed in #10594

@Veykril Veykril closed this as completed Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

3 participants