about summary refs log tree commit diff
path: root/clippy_lints/src/doc
AgeCommit message (Collapse)AuthorLines
2025-02-20Rustup (#14262)Philipp Krones-433/+9
r? @ghost changelog: none
2025-02-20Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-2/+100
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-3/+3
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-425/+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-06Rollup merge of #136645 - flip1995:clippy-subtree-update, r=ManishearthMatthias Krüger-4/+7
Clippy subtree update r? `@Manishearth`
2025-02-06Merge commit '3e3715c31236bff56f1c63a1de2c7bbdfcfb0923' into ↵Philipp Krones-4/+7
clippy-subtree-update
2025-02-06Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-4/+7
2025-02-05Correct version of `doc_overindented_list_items`Yutaro Ohno-1/+1
2025-02-03tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`Askar Safin-3/+3
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-39/+105
clippy-subtree-update
2025-01-28Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-39/+105
2025-01-28Add new lint `doc_overindented_list_items`Yutaro Ohno-38/+104
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-15use `repeat_n()` where availablelapla-cogito-1/+1
2025-01-14Add hir::HeaderSafety to make follow up commits simplerOli Scherer-1/+1
2025-01-09Merge commit '19e305bb57a7595f2a8d81f521c0dd8bf854e739' into ↵Philipp Krones-4/+11
clippy-subtree-update
2025-01-09Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-4/+11
2025-01-04turn hir::ItemKind::Fn into a named-field variantRalf Jung-2/+2
2024-12-29use the correct `ParamEnv` when checking future's output type (#13863)dswij-2/+9
Fixes #13862 `missing_headers::check` is sometimes called from outside of a body (specifically, from `check_attributes`, where the LateContext's ParamEnv is not yet properly initialized for that item). Using that empty ParamEnv for trait solving things from within the body can then lead to various ICEs, like the linked issue where we have a const generic parameter `DMA_INST` without a `ConstArgHasType` bound in the ParamEnv so the const parameter has no type, which is normally not supposed to happen. We have the item's DefId so we can just get its ParamEnv/TypingEnv from there, and using that one for trait solving should be safe. changelog: none
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-7/+113
clippy-subtree-update
2024-12-26Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-7/+113
2024-12-21use the correct `ParamEnv` when checking future's return type in ↵y21-2/+9
`missing_errors_doc`
2024-12-15Add hir::AttributeJonathan Dönszelmann-13/+12
2024-12-15Rename `value` field to `expr` to simplify later commits' diffsOli Scherer-1/+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-12-02Change `AttrArgs::Eq` into a struct variantOli Scherer-1/+1
2024-11-28Merge commit 'ff4a26d442bead94a4c96fb1de967374bc4fbd8e' into ↵Philipp Krones-0/+80
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/+73
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/+73
2024-11-18`missing_safety_doc` accept capitalized "SAFETY"overlookmotel-0/+1
2024-11-14Merge commit '786fbd6d683933cd0e567fdcd25d449a69b4320c' into ↵Philipp Krones-1/+1
clippy-subtree-update
2024-11-12new lint `unnecessary_map_or`Jacherr-1/+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