about summary refs log tree commit diff
path: root/clippy_lints/src/doc/mod.rs
AgeCommit message (Collapse)AuthorLines
2025-02-20Rustup (#14262)Philipp Krones-84/+5
r? @ghost changelog: none
2025-02-20Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-1/+99
2025-02-17Overhaul the `intravisit::Map` trait.Nicholas Nethercote-2/+2
First of all, note that `Map` has three different relevant meanings. - The `intravisit::Map` trait. - The `map::Map` struct. - The `NestedFilter::Map` associated type. The `intravisit::Map` trait is impl'd twice. - For `!`, where the methods are all unreachable. - For `map::Map`, which gets HIR stuff from the `TyCtxt`. As part of getting rid of `map::Map`, this commit changes `impl intravisit::Map for map::Map` to `impl intravisit::Map for TyCtxt`. It's fairly straightforward except various things are renamed, because the existing names would no longer have made sense. - `trait intravisit::Map` becomes `trait intravisit::HirTyCtxt`, so named because it gets some HIR stuff from a `TyCtxt`. - `NestedFilter::Map` assoc type becomes `NestedFilter::MaybeTyCtxt`, because it's always `!` or `TyCtxt`. - `Visitor::nested_visit_map` becomes `Visitor::maybe_tcx`. I deliberately made the new trait and associated type names different to avoid the old `type Map: Map` situation, which I found confusing. We now have `type MaybeTyCtxt: HirTyCtxt`.
2025-02-17Move some `Map` methods onto `TyCtxt`.Nicholas Nethercote-2/+2
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
2025-02-16Update version attribute for 1.85 clippy lintsxFrednet-2/+2
2025-02-14doc_link_code: add check for links with code spans that render weird (#14121)Catherine Flores-0/+98
This is the lint described at https://github.com/rust-lang/rust/pull/136308#issuecomment-2625485331 that recommends using HTML to nest links inside code. changelog: [`doc_link_code`]: warn when a link with code and a code span are back-to-back
2025-02-10Use a separate loop to drive the check for code clustersMichael Howell-37/+73
By using a separate loop, I can just skip nodes that I don't want to process twice, instead of having to hand-build a state machine with an enum.
2025-02-07Convert `EMPTY_LINE_AFTER_OUTER_ATTR` and `EMPTY_LINE_AFTER_OUTER_ATTR` lint ↵Guillaume Gomez-80/+1
into early lints
2025-02-07Correct version of `doc_overindented_list_items` (#14152)llogiq-1/+1
Fix the version of `doc_overindented_list_items`. It actually will be in 1.86.0, not 1.80.0. (https://github.com/rust-lang/rust/pull/136209 has a milestone of 1.86.0) changelog: none
2025-02-05Correct version of `doc_overindented_list_items`Yutaro Ohno-1/+1
2025-02-02Convert two `rustc_middle::lint` functions to `Span` methods.Nicholas Nethercote-5/+4
`rustc_middle` is a huge crate and it's always good to move stuff out of it. There are lots of similar methods already on `Span`, so these two functions, `in_external_macro` and `is_from_async_await`, fit right in. The diff is big because `in_external_macro` is used a lot by clippy lints.
2025-01-30doc_link_code: add check for `text`[`adjacent`] style linksMichael Howell-0/+62
This is the lint described at https://github.com/rust-lang/rust/pull/136308#issuecomment-2625485331 that recommends using HTML to nest links inside code.
2025-01-28Merge commit '51d49c1ae2785b24ef18a46ef233fc1d91844666' into ↵Philipp Krones-0/+34
clippy-subtree-update
2025-01-28Add new lint `doc_overindented_list_items`Yutaro Ohno-0/+34
Add a new lint `doc_overindented_list_items` to detect and fix list items in docs that are overindented. For example, ```rs /// - first line /// second line fn foo() {} ``` this would be fixed to: ```rs /// - first line /// second line fn foo() {} ``` This lint improves readabiliy and consistency in doc.
2025-01-09Merge commit '19e305bb57a7595f2a8d81f521c0dd8bf854e739' into ↵Philipp Krones-1/+1
clippy-subtree-update
2025-01-09Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-1/+1
2025-01-04turn hir::ItemKind::Fn into a named-field variantRalf Jung-1/+1
2024-12-27Make `inconsistent_struct_constructor` "all fields are shorthand" ↵Timo-1/+1
requirement configurable (#13737) Fixes #11846. This PR has three commits: - The first commit adds an `initializer-suggestions` configuration to control suggestion applicability when initializers are present. The following are the options: - "none": do not suggest - "maybe-incorrect": suggest, but do not apply suggestions with `--fix` - "machine-applicable": suggest and apply suggestions with `--fix` - The second commit fixes suggestions to handle field attributes (problem [noticed by @samueltardieu](https://github.com/rust-lang/rust-clippy/pull/13737#discussion_r1859261645)). - The third commit adds `initializer-suggestions = "machine-applicable"` to Clippy's `clippy.toml` and applies the suggestions. (Nothing seems to break.) --- changelog: make `inconsistent_struct_constructor` "all fields are shorthand" requirement configurable
2024-12-26Make "all fields are shorthand" requirement configurableSamuel Moelius-1/+1
Handle field attributes in suggestions Fix adjacent code Address review comments https://github.com/rust-lang/rust-clippy/pull/13737#discussion_r1861352124 Address all review comments but one This comment is not yet addressed: https://github.com/rust-lang/rust-clippy/pull/13737#discussion_r1874544907 `initializer_suggestions` -> `lint_inconsistent_struct_field_initializers`
2024-12-26Merge commit '609cd310be44677ae31d452a17b0f8207e1abfe1' into ↵Philipp Krones-5/+111
clippy-subtree-update
2024-12-26Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-5/+111
2024-12-15Add hir::AttributeJonathan Dönszelmann-2/+1
2024-12-15Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-5/+111
2024-12-02doc_lazy_continuation: Correctly count indent with backslashesMichael Howell-1/+6
changelog: [`doc_lazy_continuation`]: correctly count indent with backslashes
2024-12-02doc_nested_refdefs: new lint for suspicious list syntax (#13707)Jason Newcomb-5/+106
https://github.com/rust-lang/rust/issues/133150 This is more likely to be intended as an intra-doc link than it is to be intended as a refdef. If a refdef is intended, it does not need to be nested within a list item. ```markdown - [`LONG_INTRA_DOC_LINK`]: this looks like an intra-doc link, but is actually a refdef. The first line will seem to disappear when rendered as HTML. ``` > - [`LONG_INTRA_DOC_LINK`]: this > looks like an intra-doc link, > but is actually a refdef. > The first line will seem to > disappear when rendered as HTML. changelog: [`doc_nested_refdefs`]: add suspicious lint for link def at start of list items and block quotes
2024-11-28Merge commit 'ff4a26d442bead94a4c96fb1de967374bc4fbd8e' into ↵Philipp Krones-0/+35
clippy-subtree-update
2024-11-27doc_nested_refdefs: apply suggestionsMichael Howell-12/+12
Co-Authored-By: Jason Newcomb <jsnewcomb@pm.me>
2024-11-27doc_nested_refdefs: new lint for suspicious refdef syntaxMichael Howell-5/+106
This is more likely to be intended as an intra-doc link than it is to be intended as a refdef. If a refdef is intended, it does not need to be nested within a list item or quote. ```markdown - [`LONG_INTRA_DOC_LINK`]: this looks like an intra-doc link, but is actually a refdef. The first line will seem to disappear when rendered as HTML. ```
2024-11-24Add Known problems sectionMichael Howell-0/+2
2024-11-23Add note about caveat for `cfg(doc)`Michael Howell-2/+6
For example, we definitely wouldn't want to do this in libcore.
2024-11-21Add new lint `doc_include_without_cfg` (#13625)Alejandra González-0/+28
It's becoming more and more common to see people including markdown files in their code using `doc = include_str!("...")`, which is great. However, often there is no condition on this include, which is not great because it slows down compilation and might trigger recompilation if these files are updated. This lint aims at fixing this situation. changelog: Add new lint `doc_include_without_cfg`
2024-11-21Add new lint `doc_include_without_cfg`Guillaume Gomez-0/+28
2024-11-18`missing_safety_doc` accept capitalized "SAFETY"overlookmotel-0/+1
2024-11-07Merge commit 'f712eb5cdccd121d0569af12f20e6a0fabe4364d' into ↵Philipp Krones-4/+4
clippy-subtree-update
2024-10-22docs: Fix too_long_first_doc_paragraph: line -> paragraphEvan Jones-4/+4
The documentation for too_long_first_doc_paragraph incorrectly says "line" where it should say "paragraph". Fix a minor typo: doscstring -> docstring. Also do a few tiny edits to attempt to make the wording slightly shorter and clearer. changelog: Edit documentation for [`too_long_first_doc_paragraph`]
2024-10-18Merge commit 'a109190d7060236e655fc75533373fa274ec5343' into ↵Philipp Krones-1/+1
clippy-subtree-update
2024-10-15Move `too_long_first_doc_paragraph` to nurseryxFrednet-1/+1
See: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/too_long_first_doc_paragraph.20to.20nursery.3F/near/476448239
2024-10-03Merge commit 'aa0d551351a9c15d8a95fdb3e2946b505893dda8' into ↵Philipp Krones-1/+1
clippy-subtree-update
2024-09-25Fix `clippy_lints` and `clippy_utils`Samuel Moelius-1/+1
2024-09-24Merge commit '7901289135257ca0fbed3a5522526f95b0f5edba' into ↵Philipp Krones-9/+84
clippy-subtree-update
2024-09-22FormattingPhilipp Krones-3/+3
2024-09-05Correct version of `too_long_first_doc_paragraph`Kevin Reid-1/+1
`too_long_first_doc_paragraph` is, empirically, not in the Rust 1.81.0 release.
2024-08-24Merge commit '0f8eabd6231366bfc1bb1464601297c2d48f8f68' into clippyupJason Newcomb-35/+87
2024-08-24Rewrite empty_line_after_doc_comments and empty_line_after_outer_attrAlex Macleod-5/+80
2024-08-24Auto merge of #12993 - GuillaumeGomez:too_long_first_doc_paragraph, r=Centri3bors-31/+83
Add new `too_long_first_doc_paragraph` first paragraph lint Fixes https://github.com/rust-lang/rust-clippy/issues/12989. changelog: Add new `too_long_first_doc_paragraph` first paragraph lint
2024-08-12Remove `HashSet`s from `Conf`Alex Macleod-3/+3
2024-08-12fix code blocks in doc comments inconsistently using 3 or 4 spaces of ↵Antoni Spaanderman-1/+1
indentation
2024-08-08Merge commit 'cb806113e0f83a8f9b47d35b453b676543bcc40e' into ↵Philipp Krones-4/+5
clippy-subtree-update
2024-08-07Replace `in_constant` with `is_in_const_context`. Use only the state in ↵Jason Newcomb-2/+2
`LateContext` to avoid walking the HIR tree.
2024-07-31Fix false positive for `missing_backticks` in footnote referencesGuillaume Gomez-2/+3