Commit graph

75 commits

Author SHA1 Message Date
Philipp Krones
12025085b9
Merge remote-tracking branch 'upstream/master' into rustup 2025-02-20 15:26:07 +01:00
Alex Macleod
d03ae8ba6b ui_test annotation cleanup 2025-02-16 16:51:35 +00:00
Guillaume Gomez
1f94d55a18 Fix new tests updates 2025-02-15 13:38:42 +01:00
Guillaume Gomez
f666fd6417 Update UI tests 2025-02-15 13:38:16 +01:00
Esteban Küber
3a0b1ae59d Show diff suggestion format on verbose replacement
```
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
  --> $DIR/attempted-access-non-fatal.rs:7:15
   |
LL |     let _ = 2.l;
   |               ^
   |
help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix
   |
LL -     let _ = 2.l;
LL +     let _ = 2.0f64;
   |
```
2025-02-10 20:21:39 +00:00
Jana Dönszelmann
477be9470a add tests for spurious failure and fix typo 2025-02-07 16:59:17 +01:00
Michael Howell
045e36d6a7 doc_link_code: add check for text[adjacent] style links
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-30 16:10:05 -07:00
Philipp Krones
9da9ddb7db Merge commit '51d49c1ae2' into clippy-subtree-update 2025-01-28 19:33:54 +01:00
Philipp Krones
145d5adf04
Merge remote-tracking branch 'upstream/master' into rustup 2025-01-28 19:14:45 +01:00
Yutaro Ohno
4693d0a9ff Add new lint doc_overindented_list_items
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-28 16:22:28 +09:00
Mara Bos
9ad75b327a Update tests. 2025-01-07 16:04:14 +01:00
Philipp Krones
1cc50519d1 Merge commit '609cd310be' into clippy-subtree-update 2024-12-26 15:15:54 +01:00
Michael Howell
d3a7fb140c doc_lazy_continuation: Correctly count indent with backslashes
changelog: [`doc_lazy_continuation`]: correctly count indent with backslashes
2024-12-02 19:05:36 -07:00
Philipp Krones
d58b911e01 Merge commit 'ff4a26d442' into clippy-subtree-update 2024-11-28 19:38:59 +01:00
Michael Howell
44feca7f3f doc_nested_refdefs: new lint for suspicious refdef syntax
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-27 13:42:04 -07:00
Alejandra González
8298da72e7
Add new lint doc_include_without_cfg (#13625)
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-21 21:48:57 +00:00
Guillaume Gomez
404e47aa84 Add new lint doc_include_without_cfg 2024-11-21 22:43:55 +01:00
Philipp Krones
6ced8c33c0 Merge commit 'f712eb5cdc' into clippy-subtree-update 2024-11-07 22:37:01 +01:00
chrysn
bd4aa170ef Add 'CoAP' to doc-valid-idents 2024-10-30 12:57:24 +01:00
bors
c2534dcc49 Auto merge of #13460 - ROMemories:feat/freq-units-allowed-idents, r=Centri3
Add units/unit prefixes of frequency to doc-valid-idents

These units/unit prefixes often come up in the embedded world.

Should this PR also modify the `test_units` test? It seems only concerned with data units currently; should it also test frequency units?

changelog: [`doc_markdown`]: Add MHz, GHz, and THz to `doc-valid-idents`.
2024-10-24 08:50:36 +00:00
Trevor Gross
3c43a60d06 Stabilize const_option
This makes the following API stable in const contexts:

    impl<T> Option<T> {
        pub const fn as_mut(&mut self) -> Option<&mut T>;
        pub const fn expect(self, msg: &str) -> T;
        pub const fn unwrap(self) -> T;
        pub const unsafe fn unwrap_unchecked(self) -> T;
        pub const fn take(&mut self) -> Option<T>;
        pub const fn replace(&mut self, value: T) -> Option<T>;
    }

    impl<T> Option<&T> {
        pub const fn copied(self) -> Option<T>
        where T: Copy;
    }

    impl<T> Option<&mut T> {
        pub const fn copied(self) -> Option<T>
        where T: Copy;
    }

    impl<T, E> Option<Result<T, E>> {
        pub const fn transpose(self) -> Result<Option<T>, E>
    }

    impl<T> Option<Option<T>> {
        pub const fn flatten(self) -> Option<T>;
    }

The following functions make use of the unstable
`const_precise_live_drops` feature:

- `expect`
- `unwrap`
- `unwrap_unchecked`
- `transpose`
- `flatten`

Fixes: <https://github.com/rust-lang/rust/issues/67441>
2024-10-12 17:07:13 -04:00
ROMemories
62026c3228 Add units/unit prefixes of frequency to doc-valid-idents 2024-09-26 10:07:10 +02:00
Philipp Krones
b61fcbee76 Merge commit '7901289135' into clippy-subtree-update 2024-09-24 11:58:04 +02:00
Jason Newcomb
173d5a6af0 Merge commit '0f8eabd623' into clippyup 2024-08-24 18:33:44 -04:00
Alex Macleod
3474df6a8e Rewrite empty_line_after_doc_comments and empty_line_after_outer_attr 2024-08-24 18:07:31 +00:00
bors
c8b0923a73 Auto merge of #13163 - GuillaumeGomez:fix-13097, r=Alexendoo
Fix case where doc_markdown is triggered on words ending with "ified"

Fixes #13097.

r? `@Alexendoo`

changelog: Fix case where doc_markdown is triggered on words ending with "ified"
2024-08-10 17:51:56 +00:00
Philipp Krones
1ac76a2062 Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
Guillaume Gomez
edca73003b Fix false positive for missing_backticks in footnote references 2024-07-31 17:27:53 +02:00
Guillaume Gomez
88506a9147 Add regression test for #13097 2024-07-26 11:12:59 +02:00
Philipp Krones
4e6851e50b Merge commit '37f4fbb929' into clippy-subtree-update 2024-07-25 18:29:17 +02:00
Bruce Mitchener
39378cf4f4 Add more doc-valid-idents
* "AccessKit" is a commonly used accessibility toolkit used in Rust GUIs.
* "CoreFoundation", "CoreGraphics", "CoreText" are frameworks on Apple OSes.
* "Direct2D", "Direct3D", "DirectWrite" are frameworks on Windows
* "PostScript" is a programming language and is mentioned when talking about
  text and vector graphics.
* "OpenAL" is an audio framework / API.
* "OpenType" is a font format (TrueType is already mentioned).
* "WebRTC", "WebSocket", "WebTransport" are web networking technologies.
* "NetBSD" and "OpenBSD" are like the already included FreeBSD.
2024-07-13 15:50:29 +07:00
Philipp Krones
c1fd25d0aa Merge commit 'b794b8e08c' into clippy-subtree-update 2024-07-11 15:44:03 +02:00
Michael Howell
70c8579e21 doc_markdown: detect escaped ` `` when checking unmatched
Add explanatory comment to complex bounds check

Format
2024-07-02 23:27:14 +02:00
Michael Howell
6de87829da doc_lazy_continuation: blank comment line for gap
This change addresses cases where doc comments are separated
by blank lines, comments, or non-doc-comment attributes,
like this:

```rust
/// - first line
// not part of doc comment
/// second line
```

Before this commit, Clippy gave a pedantically-correct
warning about how you needed to indent the second line.
This is unlikely to be what the user intends, and has
been described as a "false positive" (since Clippy is
warning you about a highly unintuitive behavior that
Rustdoc actually has, we definitely want it to output
*something*, but the suggestion to indent was poor).

https://github.com/rust-lang/rust-clippy/issues/12917
2024-06-27 17:09:54 -07:00
Philipp Krones
f67f72695a Merge commit 'c9139bd546' into clippy-subtree-update 2024-05-30 10:49:05 +02:00
bors
5d10538fb4 Auto merge of #12809 - GuillaumeGomez:missing-backticks-fix, r=y21
Correctly handle closing parens in `missing_backticks` doc lint

Fixes #12795.

changelog: Correctly handle closing parens in `doc_markdown` lint
2024-05-25 12:03:07 +00:00
Hamir Mahal
17cc0a3a7d
feat: auto-fix for bare URLs in doc comments 2024-05-24 14:30:42 -07:00
Guillaume Gomez
4f98cc6d55 Correctly handle closing parens in missing_backticks doc lint 2024-05-21 14:55:30 +02:00
Michael Howell
b5cf8b8277 doc_lazy_continuation: do not warn on End events
This avoids event spans that would otherwise cause crashes, since an
End's span covers the range of the tag (which will be earlier than the
line break within the tag).
2024-05-18 16:19:41 -07:00
Michael Howell
f3dd31e214 Add lint for markdown lazy paragraph continuations
This is a follow-up for https://github.com/rust-lang/rust/pull/121659,
since most cases of unintended block quotes are lazy continuations.
The lint is designed to be more generally useful than that, though,
because it will also catch unintended list items and unintended
block quotes that didn't coincidentally hit a pulldown-cmark bug.
2024-05-06 16:31:21 -07:00
Alex Macleod
d4a8f61eb3 Use check_attributes in doc lints 2024-04-05 16:12:07 +00:00
Guillaume Gomez
03d7ae8153 Also handle <blockquote> and <q> HTML tags 2024-03-13 19:31:01 +01:00
Guillaume Gomez
cd36b25c4f Add regression test for #10262 2024-03-13 19:25:36 +01:00
bors
21efd39b04 Auto merge of #12423 - GuillaumeGomez:code-wrapped-element, r=Alexendoo
Don't emit "missing backticks" lint if the element is wrapped in `<code>` HTML tags

Fixes #9473.

changelog: Don't emit "missing backticks" lint if the element is wrapped in `<code>` HTML tags
2024-03-05 14:02:54 +00:00
Guillaume Gomez
bd9b9ffa04 Add regression test for #9473 2024-03-05 12:07:37 +01:00
Samuel Moelius
cc4c8db0fd Handle plural acronyms in doc_markdown 2024-03-04 22:00:24 +00:00
Philipp Krones
4363278c73 Merge commit '2efebd2f0c' into clippy-subtree-update 2024-05-21 10:39:30 -07:00
Philipp Krones
a5aaf33422 Merge commit 'ca3b393750' into clippy-subtree-update 2024-04-18 17:48:52 +02:00
Philipp Krones
0e62b18435 Merge commit '9d6f41691e' into clippy-subtree-update 2024-03-21 22:20:40 +01:00
Philipp Krones
7e83df4068 Merge commit '93f0a9a91f' into clippy-subtree-update 2024-03-07 17:19:29 +01:00