instance_id stringlengths 10 65 | repo stringlengths 5 59 | pr_number int64 1 313k | task_type stringclasses 1
value | base_commit stringlengths 40 40 | review_commit stringlengths 40 40 | title stringlengths 2 282 | body stringlengths 7 3k | patch stringlengths 202 204k | n_defects int64 1 72 | n_supported int64 1 65 | n_major int64 0 32 | defects stringlengths 140 18.8k | certifier_count int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rust-lang__packed_simd__168 | rust-lang/packed_simd | 168 | defect | 3267138795ce5b6472f7a4d52a7d91ef4187b19d | 5bc1becc0c3ff865cc200cf0686822b952502760 | Update all crates to Rust 2018 Edition | The main crate and the examples have been updated to Rust 2018, as well as the `verify` and `micro_benchmarks` crates. Also fixes #167. | diff --git a/Cargo.toml b/Cargo.toml
index 5aa8d473f..cba8ada57 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,7 @@ repository = "https://github.com/rust-lang-nursery/packed_simd"
keywords = ["simd", "vector", "portability"]
categories = ["hardware-support", "concurrency", "no-std", "data-structures"]
license =... | 5 | 3 | 3 | [{"id": "G0", "claim": "The example benchmarks are never built on CI; CI should build them without running them.", "category": "testing", "verdict": "uncertain", "priority": "P1", "scope": "pre_existing"}, {"id": "G1", "claim": "packed_simd's library code must not use core:: (or std::) absolute paths and should keep th... | null |
rust-lang__packed_simd__322 | rust-lang/packed_simd | 322 | defect | cf07679856271a4dafa41158b8808588bea95554 | 31ae9451bf6fcf8cca8ad0cbef138a89dab632e4 | 0.3.5: Get current with rustc const generics | This PR fixes the build for `packed_simd_2`, now `0.3.5`, with the current nightly, for all major platforms. This is motivated by several internal changes to how rustc handles const arguments, as `packed_simd` is an avid consumer of the hidden dragons inside rustc's internal APIs and so the breakage affects `packed_sim... | diff --git a/build.rs b/build.rs
index 9bdc8b542..e87298a2d 100644
--- a/build.rs
+++ b/build.rs
@@ -1,6 +1,5 @@
fn main() {
- let target = std::env::var("TARGET")
- .expect("TARGET environment variable not defined");
+ let target = std::env::var("TARGET").expect("TARGET environment variable not defined")... | 1 | 1 | 0 | [{"id": "G0", "claim": "The FIXME comment should be placed above improper_ctypes_definitions in the allow list in src/lib.rs.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__pkg-config-rs__115 | rust-lang/pkg-config-rs | 115 | defect | e94a5336cd66451df892af2399dd1b38577db5d3 | ce31267d35ea2f73953b434d5e6032f7ba75700c | Add support for -isystem, -iquote, -idirafter include flags | Fixes https://github.com/rust-lang/pkg-config-rs/issues/114 | diff --git a/src/lib.rs b/src/lib.rs
index 1587d69..00527f3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -540,7 +540,7 @@ impl Library {
config.print_metadata(&meta);
self.framework_paths.push(PathBuf::from(val));
}
- "-I" => {
+ "-... | 1 | 1 | 1 | [{"id": "G0", "claim": "The new flags were added to the arm that parses two-character flags, so -isystem/-iquote/-idirafter values would be truncated to two characters; parsing of the arguments has to be redone.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
rust-lang__pkg-config-rs__131 | rust-lang/pkg-config-rs | 131 | defect | d442626a84125cda0a66adbd16514aa084350a97 | 9465edd6a2f1c8b5ae4f2e6a8be931b0f7d96d2c | Adding rpath support | I'm not quite sure if this project wants to support it, but it would be a nice to have in my opinion. | diff --git a/src/lib.rs b/src/lib.rs
index daf5d0c..0d7c0b2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -98,6 +98,7 @@ pub struct Library {
pub frameworks: Vec<String>,
pub framework_paths: Vec<PathBuf>,
pub include_paths: Vec<PathBuf>,
+ pub rpaths: Vec<PathBuf>,
pub defines: HashMap<String, Opt... | 1 | 1 | 1 | [{"id": "G0", "claim": "Instead of supporting specific linker arguments such as -rpath, the PR should pass all `-Wl` arguments through to the linker as-is, which would also cover useful flags like `-rpath-link`.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
rust-lang__pkg-config-rs__166 | rust-lang/pkg-config-rs | 166 | defect | 246ece2c314552f891692fb66fce2027156b38be | 02f7519ce253bd9c20b22226deedb9bf0917db42 | Update to edition 2018 | This crate is one of the last ones on the edition 2015. | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 304ae24..7cce02b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
rust:
- - 1.30.0
+ - 1.31.0
- stable
- beta
... | 1 | 1 | 1 | [{"id": "G0", "claim": "Add a Cargo.lock.msrv with versions that compile with Rust 1.31, switch the CI MSRV job back to 1.31, and copy that lock file in place for the 1.31 build so it is used.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
rust-lang__pkg-config-rs__75 | rust-lang/pkg-config-rs | 75 | defect | f867f8be1babca4d6d9cddc92a817519ae845193 | 590088bfa0402a41e36098b35aec2029edd58079 | Support specifying range of versions. | close #74
This PR adds two new methods: `eq_version` and `range_version`. | diff --git a/src/lib.rs b/src/lib.rs
index 88dd310..ebe4983 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -71,6 +71,7 @@ use std::error;
use std::ffi::{OsStr, OsString};
use std::fmt;
use std::io;
+use std::ops::{Bound, RangeBounds};
use std::path::{PathBuf, Path};
use std::process::{Command, Output};
use std::str;... | 2 | 2 | 1 | [{"id": "G0", "claim": "The new method `eq_version()` should be named `exactly_version()`.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "Tests should also cover inclusive (`..=`) range bounds, not only exclusive ones, for `range_version`.", "ca... | null |
rust-lang__regex__1330 | rust-lang/regex | 1,330 | defect | 5ea3eb1e95f0338e283f5f0b4681f0891a1cd836 | 685c875200f78fe84e47d5de6b50ffdd4e023eee | automata: fix `onepass::DFA::try_search_slots` panic when too many slots are given | The API specifically documents that the caller may provide *any* number
of slots. But the onepass implementation was panicking when too many
were provided. (I had only considered the case when too few were
provided when I wrote one-pass implementation I think.)
This already works for the PikeVM and the bounded ba... | diff --git a/regex-automata/src/dfa/onepass.rs b/regex-automata/src/dfa/onepass.rs
index 85f820ef54..e0ef863a56 100644
--- a/regex-automata/src/dfa/onepass.rs
+++ b/regex-automata/src/dfa/onepass.rs
@@ -2093,9 +2093,20 @@ impl DFA {
// be bad. In theory, we could avoid all this slot clearing if we knew
... | 2 | 2 | 0 | [{"id": "G0", "claim": "The typo in the newly added comment should be fixed, changing \"the caller can provided any number of slots\" to \"the caller can provide any number of slots\".", "category": "documentation", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "The commented-o... | null |
rust-lang__regex__376 | rust-lang/regex | 376 | defect | 610c2ec13ce8bea7d5081d56bdaf40e22b7f0b94 | 94f8213def69a289b1f368e996ef49ec21d5a2fd | Fix clippy warnings | This fixes all clippy warnings, mostly lifetime elisions and useless borrows. Clippy now passes on nightly; on stable/without clippy, no lint warnings are given. All tests still pass.
I've not moved any code around, which is the reason for allowing `string_lit_as_bytes` in so many places.
Up for review | diff --git a/examples/shootout-regex-dna-bytes.rs b/examples/shootout-regex-dna-bytes.rs
index ec57157c8e..4010324db7 100644
--- a/examples/shootout-regex-dna-bytes.rs
+++ b/examples/shootout-regex-dna-bytes.rs
@@ -55,7 +55,7 @@ fn main() {
(regex!("Y"), &b"(c|t)"[..]),
];
let mut seq = seq;
- for... | 15 | 14 | 3 | [{"id": "G0", "claim": "Instead of the added #[allow(len_without_is_empty)] on Captures::len in src/re_bytes.rs, implement fn is_empty() -> bool { debug_assert!(self.len() > 0); false } so it const-folds and warns anyone expecting empty captures.", "category": "design", "verdict": "opposed", "priority": "P3", "scope": ... | null |
rust-lang__regex__529 | rust-lang/regex | 529 | defect | 488fe569575ea06e1d8c5b9f98f95d9644e1efa8 | 7d4891747ef564574d7b6aa79bc1de1acdb9e784 | Add ability get receive pattern from a RegexSet | It is useful to access the regex one provided once to the regexset(-builder).
Instead to let the user store the regex in a seperate list to index them later, one can now receive the patterns from regexset directly.
This is a followup to https://github.com/rust-lang/regex/pull/528#issuecomment-431342324 which not us... | diff --git a/src/re_set.rs b/src/re_set.rs
index cfca0ea405..8c1aefbc13 100644
--- a/src/re_set.rs
+++ b/src/re_set.rs
@@ -216,6 +216,36 @@ impl RegexSet {
pub fn len(&self) -> usize {
self.0.regex_strings().len()
}
+
+ /// Returns the patterns that this set will match on.
+ ///
+ /// This f... | 1 | 1 | 0 | [{"id": "G0", "claim": "The doc comment on the new patterns() method should be reworded to say that the function determines the pattern for a match and that the returned slice has one entry per pattern given to the set, in the same order as the patterns were provided.", "category": "documentation", "verdict": "supporte... | null |
rust-lang__regex__582 | rust-lang/regex | 582 | defect | 59517451d7fd9f53d34392b82cc3f96877200f93 | 747f5367ee80da532e43361b9ac41b9fc774acf2 | syntax: better error message for missing repetition quantifier | Hi, first contribution to the Rust ecosystem, hopefully I'll get it right.
This is to solve @CAD97 issue https://github.com/rust-lang/regex/issues/545 which raised an uncleared error message when repetition quantifiers were not followed by a valid decimal (other languages would treat the `{}` as characters and this ... | diff --git a/regex-syntax/src/ast/mod.rs b/regex-syntax/src/ast/mod.rs
index 884fcfa35c..fa4d899824 100644
--- a/regex-syntax/src/ast/mod.rs
+++ b/regex-syntax/src/ast/mod.rs
@@ -153,6 +153,9 @@ pub enum ErrorKind {
/// The range provided in a counted repetition operator is invalid. The
/// range is invalid i... | 4 | 4 | 0 | [{"id": "G0", "claim": "The new Display message should start with a lowercase letter to match the style of the surrounding error messages.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "The added code exceeds the 79-column limit and should be re... | null |
rust-lang__regex__728 | rust-lang/regex | 728 | defect | 83c2fcdfc88875ac82733e0e3841b8b3f223a0e2 | 9925d55dfd91dce8eef881884c5828b052bde895 | implement `regex::Replacer` for `String`, `&String`, `Cow<'a, str>`, `&Cow<'a, str>` | It is inconvenient to get `&str` in some cases, for example:
```rust
extern crate regex; // 1.4.2
extern crate chrono; // 0.4.19
fn main() {
let input = "today is time";
let today = chrono::Local::now();
let re = regex::Regex::new(r"time").unwrap();
let s = re.replace(input, &*format!("{}", to... | diff --git a/src/re_unicode.rs b/src/re_unicode.rs
index ea95c1b6df..bb2475312e 100644
--- a/src/re_unicode.rs
+++ b/src/re_unicode.rs
@@ -1190,10 +1190,55 @@ impl<'a> Replacer for &'a str {
}
fn no_expansion(&mut self) -> Option<Cow<str>> {
- match find_byte(b'$', self.as_bytes()) {
- Som... | 2 | 2 | 1 | [{"id": "G0", "claim": "Update the docs on the `Replacer` trait, which call out the `&str` impl specifically, to say instead that it is implemented for `&str` along with other variants of string types.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim":... | null |
rust-lang__rust-analyzer__18018 | rust-lang/rust-analyzer | 18,018 | defect | 914a1caab54e48a028b2407d0fe6fade89532f67 | 9a1f023903a9099a82c6751d3c36b430ca0839cd | feat: Automatically add semicolon when completing unit-returning functions | But provide a config to suppress that.
I didn't check whether we are in statement expression position, because this is hard in completion (due to the natural incompleteness of source code when completion is invoked), and anyway using function returning unit as an argument to something seems... dubious.
Fixes #172... | diff --git a/crates/ide-completion/src/completions/dot.rs b/crates/ide-completion/src/completions/dot.rs
index d55bc3ea5d03a..f2c360a9d5bfd 100644
--- a/crates/ide-completion/src/completions/dot.rs
+++ b/crates/ide-completion/src/completions/dot.rs
@@ -600,7 +600,7 @@ fn foo(a: A) { a.$0 }
struct A {}
trait Trait { f... | 4 | 3 | 2 | [{"id": "G0", "claim": "The pull request removed the complete_fn_mut_param_has_attribute test in crates/ide-completion/src/render/function.rs (dropping its coverage of completing parameters with attributes), which the author confirmed was accidental.", "category": "testing", "verdict": "supported", "priority": "P2", "s... | null |
rust-lang__rust-analyzer__18085 | rust-lang/rust-analyzer | 18,085 | defect | 08c7bbc2dbe4dcc8968484f1a0e1e6fe7a1d4f6d | 57ad99fe0d732194797056b94f5cbbfd94e96354 | feat: Provide an config option to not set `cfg(test)` | Fixes #17957. | diff --git a/crates/cfg/src/lib.rs b/crates/cfg/src/lib.rs
index e9daaf7de3c3b..c2d4008605618 100644
--- a/crates/cfg/src/lib.rs
+++ b/crates/cfg/src/lib.rs
@@ -49,6 +49,10 @@ impl CfgOptions {
cfg.fold(&|atom| self.enabled.contains(atom))
}
+ pub fn check_atom(&self, cfg: &CfgAtom) -> bool {
+ ... | 4 | 4 | 1 | [{"id": "G0", "claim": "`cargo.check.allTargets` should not fall back to the `cfg.setTest` config when left unset — coupling the two configs is an odd choice since `allTargets` covers more than just tests, and people who set one config can also unset the other.", "category": "design", "verdict": "supported", "priority"... | null |
rust-lang__rust-analyzer__18278 | rust-lang/rust-analyzer | 18,278 | defect | 0fb804acb375b02a3beeaceeb75b71969ef37b15 | 963113f5ecc6fe730367030e748853c734ab93c7 | Do not consider match/let/ref of place that evaluates to ! to diverge, disallow coercions from them too | Resolves #18237 | diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs
index 8bc3c50725d99..583d8a70d3bed 100644
--- a/crates/hir-ty/src/infer.rs
+++ b/crates/hir-ty/src/infer.rs
@@ -1154,6 +1154,7 @@ impl<'a> InferenceContext<'a> {
_ = self.infer_expr_coerce(
self.body.body_expr,
... | 2 | 1 | 0 | [{"id": "G0", "claim": "rust-analyzer does not emit the type-mismatch error for the ref-of-place case (let ref _x: () = *x where *x: !), so the test that should produce a type-mismatch error without this PR cannot be written; the author defers it to a new follow-up issue.", "category": "correctness", "verdict": "uncert... | null |
rust-lang__rust-analyzer__18385 | rust-lang/rust-analyzer | 18,385 | defect | f9935be0132d461396ee4e82f7be446aa9aa112b | 3f48da27dd6bdc00b9002831227a2caf763d5c43 | feat: Add assist to generate a type alias for a function | closes #18343
Technically this doesn't support generating `for <...>` lifetimes, but I'm not very familiar with them, and they seem a bit outside of the scope of an assist like this. If somebody has a way to generate them feel free to add it.
Also, when generating aliases with self parameters, they are left unname... | diff --git a/crates/ide-assists/src/handlers/generate_fn_type_alias.rs b/crates/ide-assists/src/handlers/generate_fn_type_alias.rs
new file mode 100644
index 000000000000..597d94d3fc64
--- /dev/null
+++ b/crates/ide-assists/src/handlers/generate_fn_type_alias.rs
@@ -0,0 +1,442 @@
+use either::Either;
+use hir::HirDispl... | 8 | 5 | 0 | [{"id": "G0", "claim": "Move this below the `let func` line so non-functions are filtered out as early as possible.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The `module` scope lookup inside the `for style in ParamStyle::ALL` loop does not ... | null |
rust-lang__rust-analyzer__18419 | rust-lang/rust-analyzer | 18,419 | defect | 6a67a4d3cd480dbbc3b1dec461a31b1bea1dfba4 | 0a44820080eb1a1d5bbbd0d5b6bcce1f079acf39 | fix: Put leading `|` in patterns under `OrPat` | Previously it was one level above, and that caused problems with macros that expand to it, because macros expect to get only one top-level node.
Fixes #18333. | diff --git a/crates/hir-def/src/body/lower.rs b/crates/hir-def/src/body/lower.rs
index b87e94f9c51de..9bdd0c3115dd0 100644
--- a/crates/hir-def/src/body/lower.rs
+++ b/crates/hir-def/src/body/lower.rs
@@ -1598,6 +1598,10 @@ impl ExprCollector<'_> {
for (id, _) in current_is_used.into_iter() {
... | 1 | 1 | 0 | [{"id": "G0", "claim": "The one-item OR pattern check should use a slice pattern (`if let &[pat] = &*pats { return pat; }`) instead of `pats.len() == 1` with `pats.into_iter().next().unwrap()`.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-analyzer__18559 | rust-lang/rust-analyzer | 18,559 | defect | 9224ec44978b6817510b0b2999c7cf25c1ab837f | c083e8f815dee0b49ba6be6fb58273a3a06d8f13 | fix: Fix a stack overflow when computing the sizedness of a struct that includes itself as the tail field | Fixes #18556.
**Warning to the reviewer:** If you are going to open this in your editor of choice (with r-a of course), r-a will restart again and again, because we provide (some) IDE functionality to our tests which implies this actually overflows the stack when the test is present... Ask me how I know. | diff --git a/crates/hir-ty/src/infer/unify.rs b/crates/hir-ty/src/infer/unify.rs
index e4881d7520138..03035c6072ccf 100644
--- a/crates/hir-ty/src/infer/unify.rs
+++ b/crates/hir-ty/src/infer/unify.rs
@@ -936,8 +936,9 @@ impl<'a> InferenceTable<'a> {
let last_field_ty =
self.db.fie... | 5 | 3 | 2 | [{"id": "G0", "claim": "The S1 self-comparison guard is not enough: a chain of structs that each have the previous one as tail field can still be built so that computing sizedness overflows the stack.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "T... | null |
rust-lang__rust-analyzer__18604 | rust-lang/rust-analyzer | 18,604 | defect | e6276c8b641c05f2e5d2bbe941726a5fea12d803 | 091a4545bd4adec9304627b3b750431fa48360ec | feat: Complete derive helper attributes | Only their names, anything can go inside.
Closes #18588.
This only completes when you type the first letter, I don't know why... | diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 46766fcc5b102..65470d061b37b 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -510,6 +510,22 @@ impl<'db> SemanticsImpl<'db> {
self.with_ctx(|ctx| ctx.has_derives(adt))
}
+ pub fn derive_helpers_... | 2 | 1 | 1 | [{"id": "G0", "claim": "Derive helpers do not have to accept a token tree (they can be bare or kv style), so the completion should not offer them with `()` appended.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The listed syntax kinds could also a... | null |
rust-lang__rust-analyzer__18723 | rust-lang/rust-analyzer | 18,723 | defect | 0a706f7d2ac093985eae317781200689cfd48b78 | a8a8e02eb2862069410ac8480cf794e061dfa69a | fix: Fix a case where completion was unable to expand a macro | Which caused the macros of the popular `tracing` crate to not offer completions.
The reason is rather complicated: it boils down to macro ignoring their input and completion always choosing the first expansion.
What started as a fairly simple feature request turned out to be a nightmary-ish group of changes on to... | diff --git a/crates/hir-expand/src/db.rs b/crates/hir-expand/src/db.rs
index 0d19ae202ce05..fa400378f3af0 100644
--- a/crates/hir-expand/src/db.rs
+++ b/crates/hir-expand/src/db.rs
@@ -153,13 +153,13 @@ fn syntax_context(db: &dyn ExpandDatabase, file: HirFileId) -> SyntaxContextId {
/// This expands the given macro ca... | 10 | 8 | 3 | [{"id": "G0", "claim": "Do not introduce a new node kind (ITEM_RECOVERY) for item recovery; an error node should suffice.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "After the pull request removes the old assertion from macro_call, it should assert th... | null |
rust-lang__rust-analyzer__18832 | rust-lang/rust-analyzer | 18,832 | defect | 6725e046df7493c1047e115ebc7180fb06416038 | 67802752c7a999331dfb97a435a92169f174a140 | fix: do not offer completions within macro strings | Fixes #17479
This PR disables completions within strings in proc macros. | diff --git a/crates/ide-completion/src/context/analysis.rs b/crates/ide-completion/src/context/analysis.rs
index 1c4cbb25b1fdd..a96ba5d1f2f4d 100644
--- a/crates/ide-completion/src/context/analysis.rs
+++ b/crates/ide-completion/src/context/analysis.rs
@@ -417,6 +417,14 @@ fn analyze(
derive_ctx,
} = expa... | 5 | 5 | 3 | [{"id": "G0", "claim": "The pull request should add a test covering the new no-completions-in-macro-strings behaviour, using the existing tests in crates/ide-completion/src/tests as a model.", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The added test ... | null |
rust-lang__rust-analyzer__18998 | rust-lang/rust-analyzer | 18,998 | defect | 0fd4fc35228667bc9aa6004080737e0e559784f4 | e9382bf466b000d59ea3d0bf7736d9ebf7045ddc | fix: Make `rust-analyzer.files.excludeDirs` work, actually | I have no idea what the original writer of the code thought (CC @matklad, I don't expect you to remember but it was you), but the logic just seems backwards. We should not exclude a file/directory if it is equal to an include! This also meant that we had to add a `root == path` check so this stuff will actually work, w... | diff --git a/crates/load-cargo/src/lib.rs b/crates/load-cargo/src/lib.rs
index 5654c04a59287..67ee9d1119971 100644
--- a/crates/load-cargo/src/lib.rs
+++ b/crates/load-cargo/src/lib.rs
@@ -94,7 +94,9 @@ pub fn load_workspace(
let contents = loader.load_sync(path);
let path = vfs::VfsPath::from... | 3 | 2 | 2 | [{"id": "G0", "claim": "The loader must keep skipping a nested root B while scanning its parent A (B is in the include list), otherwise B will be scanned twice.", "category": "performance", "verdict": "supported", "priority": "P1", "scope": "unclear"}, {"id": "G1", "claim": "The exclusion check should perhaps be pushed... | null |
rust-lang__rust-analyzer__19012 | rust-lang/rust-analyzer | 19,012 | defect | 84d44d0a574630aa8500ed62b6c01ccd3fae2473 | ee85219c1f517e04bf1ce007224c02318c6f750b | feat: Implement `arbitrary-self-types` | Resolves #19002 | diff --git a/crates/hir-def/src/lang_item.rs b/crates/hir-def/src/lang_item.rs
index afdc49a2dc59a..317a9ca378b67 100644
--- a/crates/hir-def/src/lang_item.rs
+++ b/crates/hir-def/src/lang_item.rs
@@ -372,6 +372,7 @@ language_item_table! {
DerefMut, sym::deref_mut, deref_mut_trait, ... | 2 | 2 | 0 | [{"id": "G0", "claim": "Rename the newly added lang item variant `ReceiveTarget` to `ReceiverTarget` to match the `receiver_target` symbol it wraps.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "Delete the leftover commented-out debug line `// ... | null |
rust-lang__rust-analyzer__19066 | rust-lang/rust-analyzer | 19,066 | defect | bc10a4479821188597be042b332e2ed9b3769376 | ba2da96871869ab4c094d1d34a6ed5224a7d11e3 | fix: try to infer array type from slice pattern | fixes #16609 | diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs
index 3c258e3c4cf4b..59c6ba18eee1c 100644
--- a/crates/hir-ty/src/infer.rs
+++ b/crates/hir-ty/src/infer.rs
@@ -943,7 +943,7 @@ impl<'a> InferenceContext<'a> {
let ty = self.insert_type_vars(ty);
let ty = self.normalize_assoc... | 8 | 7 | 0 | [{"id": "G0", "claim": "The doc comment says the compiler would report ambiguity in the given situation, but it does not, so the reviewer asks whether the new gating logic is actually correct.", "category": "documentation", "verdict": "uncertain", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The bod... | null |
rust-lang__rust-analyzer__19122 | rust-lang/rust-analyzer | 19,122 | defect | 35181e167efb94d5090df588e6af9f93250421f3 | ca20cd8c06d0f2797f551978fd468ce0f269bf37 | pass struct fields to chalk | Closes #19003 | diff --git a/crates/hir-ty/src/chalk_db.rs b/crates/hir-ty/src/chalk_db.rs
index c8ff6cba3dd18..8e7e667b9b901 100644
--- a/crates/hir-ty/src/chalk_db.rs
+++ b/crates/hir-ty/src/chalk_db.rs
@@ -768,8 +768,7 @@ pub(crate) fn adt_datum_query(
phantom_data,
};
- // this slows down rust-analyzer by quite ... | 4 | 1 | 1 | [{"id": "G0", "claim": "Enabling real field data for chalk may slow rust-analyzer down severely (an approximately 12s analysis-stats regression), and a cheaper approach or workaround should be found instead of accepting the slowdown.", "category": "performance", "verdict": "supported", "priority": "P1", "scope": "intro... | null |
rust-lang__rust-analyzer__19956 | rust-lang/rust-analyzer | 19,956 | defect | bf6d44581085bb9b6e285902a7fae77325703171 | 38a3d655ebb4943af2f5c20d104604a7f62c35ad | Implement `feature(more_qualified_paths)` | Example:
```rust
struct T;
struct S {
a: u32,
}
trait Trait {
type Assoc;
}
impl Trait for T {
type Assoc = S;
}
let <T as Trait>::Assoc { a } = <T as Trait>::Assoc { a: 0 };
``` | diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs
index 14eb716075303..b5a05052d482d 100644
--- a/crates/hir-ty/src/infer.rs
+++ b/crates/hir-ty/src/infer.rs
@@ -1731,6 +1731,88 @@ impl<'db> InferenceContext<'db> {
self.resolve_variant_on_alias(ty, unresolved, mod_path)
... | 4 | 3 | 2 | [{"id": "G0", "claim": "Qualified paths naming enum variants do not resolve — of the author's examples (<E>::ES { .. }, <E>::ET(..), <E as Trait>::Assoc::ES/ET) r-a resolves only ET(0) in expressions — because the TraitId branch's loop was copied incorrectly from SelfType; the reviewer asks to check path.type_anchor() ... | null |
rust-lang__rust-analyzer__20299 | rust-lang/rust-analyzer | 20,299 | defect | 922e04a134f789737b5b7a954bd62a8f4cbb0e8b | 70552cb28d3e5cfd8d40091caba7b4868e139fef | Add auto trait name for generate_trait_from_impl | Auto generate trait name from first method.
Input:
```rust
impl S$0 {
fn foo() {}
}
```
Old output:
```rust
trait NewTrait {
fn foo();
}
impl NewTrait for S {
fn foo() {}
}
```
This PR output:
```rust
trait Foo {
fn foo();
}
impl Foo for S {
fn foo() {}
}
```
| diff --git a/crates/ide-assists/src/handlers/generate_trait_from_impl.rs b/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
index 92a4bd35b3e78..db0b6a3fc76a6 100644
--- a/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
+++ b/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
@@ -49,7 +4... | 1 | 1 | 0 | [{"id": "G0", "claim": "Deriving the trait name from the first method may not be advantageous, and the reviewer prefers using the method name only when the impl has exactly one method.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-analyzer__21012 | rust-lang/rust-analyzer | 21,012 | defect | d4ed56f45ce57886875543a8991f459fe43a0655 | fdc2bee7fad20079947c0ab9f6e496416ca5ea2d | feat: Implement thin-arrow completion in fn return position | Very cool feature that can quickly complete simple return types
Close rust-lang/rust-analyzer#20885
Example
---
```rust
fn foo() u$0
```
**Before this PR**
```text
kw where
```
**After this PR**
```text
bt u32 (adds ->) u32
kw where
...
```
```rust
fn foo() -> u32
```
| diff --git a/crates/ide-completion/src/completions.rs b/crates/ide-completion/src/completions.rs
index 355687b2032be..15bf8c10eea54 100644
--- a/crates/ide-completion/src/completions.rs
+++ b/crates/ide-completion/src/completions.rs
@@ -34,7 +34,7 @@ use crate::{
CompletionContext, CompletionItem, CompletionItemKi... | 3 | 3 | 1 | [{"id": "G0", "claim": "Thin-arrow completion should not be limited to single-name-ref paths: an arrow should also be completable for qualified return types like `fn foo() bar::baz|`, e.g. by inserting the arrow after the `)`.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}... | null |
rust-lang__rust-analyzer__21654 | rust-lang/rust-analyzer | 21,654 | defect | 00a9173e57f5c4ba45e380ce065b31afb17436ad | b3feb5f67d5b913dea24145b5e55cc52805ff557 | fix: use `ExprIsRead::Yes` for rhs of binary operators | the rhs of binary operators (including compound assignments like `+=`) was inferred with `ExprIsRead::No`, which prevented divergence detection for place expressions of type `!`. this caused false type mismatches when a function's return type depended on the block diverging after something like `x += *never_ptr`. the r... | diff --git a/crates/hir-ty/src/infer/op.rs b/crates/hir-ty/src/infer/op.rs
index c79c828cd442..95d63ffb508f 100644
--- a/crates/hir-ty/src/infer/op.rs
+++ b/crates/hir-ty/src/infer/op.rs
@@ -178,9 +178,9 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
// trait matching creating lifetime constraints that a... | 3 | 1 | 1 | [{"id": "G0", "claim": "Setting ExprIsRead::Yes here (and same below) is not correct: the LHS of a (non-binop) assignment should not constitute a read.", "category": "correctness", "verdict": "opposed", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The binop_lhs_never_place_diverges test still does n... | null |
rust-lang__rust-analyzer__21704 | rust-lang/rust-analyzer | 21,704 | defect | ff041aa3373a0440611e6ecebdcf8f6f86fa9b9f | e3402265259c18e006d948db7c3aed51a6d17aba | fix: load rust-analyzer.toml for virtual workspaces | ## Summary
Fixes the most common case of broken `rust-analyzer.toml` loading: virtual workspaces
For virtual workspaces, `ProjectWorkspace::to_roots()` only creates `PackageRoot`s for member crate packages. The workspace root directory itself gets none.
Any `rust-analyzer.toml` placed at the workspace root the... | diff --git a/crates/load-cargo/src/lib.rs b/crates/load-cargo/src/lib.rs
index 654ff4f75b0e6..ca7f90e7d136e 100644
--- a/crates/load-cargo/src/lib.rs
+++ b/crates/load-cargo/src/lib.rs
@@ -282,6 +282,19 @@ impl ProjectFolders {
}
}
+ for ws in workspaces.iter() {
+ let ws_root ... | 2 | 2 | 2 | [{"id": "G0", "claim": "Including the whole workspace root in the new PackageRoot will pull unwanted things into the workspace; instead only `ws_root/rust-analyzer.toml` should be included.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The PR remov... | null |
rust-lang__rust-analyzer__21705 | rust-lang/rust-analyzer | 21,705 | defect | 05da4cf3c4dfb8aa3430343f41e73c4cfad46bd5 | 441213cb859abc673e9582052e3dc2f3349a88ea | fix: cfg_select supports non token-tree tokens | Fixes rust-lang/rust-analyzer#21702
- Fix single non-curly groups is ignored `true => ((),)`, old: `(),`, new: `((),)`
Example
---
```rust
const _: i32 = cfg_select! { true => 2 + 3, _ => 3 + 4 };
```
**Before this PR**
```rust
const _: i32 = cfg_select! { true => 2 /* expected a token tree after `=>` */+ 3, _ => 3... | diff --git a/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs b/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs
index eeaf865338bd6..f2a512d1915d9 100644
--- a/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs
+++ b/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs
@@ -568... | 1 | 1 | 1 | [{"id": "G0", "claim": "Delimiting the expression by hand-rolled scanning for commas (in S2, plus angle-bracket tracking) is not how rustc does it and will break on paths with commas like `foo::<T, U>`; the expression must be parsed by invoking the parser, as the macro_rules matcher does with expect_fragment().", "cate... | null |
rust-lang__rust-analyzer__21921 | rust-lang/rust-analyzer | 21,921 | defect | 63b3eff38ef1c216480147dd53b0e4365d55f269 | cdd133021f0c6fbcba07f89c77ed7f886aaef84c | fix: unconditionally pass --include-ignored for test runnables | Fixes rust-lang/rust-analyzer#21889
This replaces the conditional --ignored flag with an unconditional --include-ignored flag for test runnables. | diff --git a/crates/rust-analyzer/src/target_spec.rs b/crates/rust-analyzer/src/target_spec.rs
index 8be061cacfa89..d3848e95fd9fe 100644
--- a/crates/rust-analyzer/src/target_spec.rs
+++ b/crates/rust-analyzer/src/target_spec.rs
@@ -274,15 +274,13 @@ impl CargoTargetSpec {
let mut executable_args = Vec::new();... | 3 | 3 | 1 | [{"id": "G0", "claim": "The pull request should also remove the `TestAttr` type (and the `attr` field on `RunnableKind::Test`), which the change made unnecessary.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "In crates/rust-analyzer/src/target_... | null |
rust-lang__rust-analyzer__21987 | rust-lang/rust-analyzer | 21,987 | defect | 129f6167ab924c42fb16d4e3d1b31b6e725c7523 | e73727319e77fa5eb7e8d82f2674ac955da1d96b | part of Support gen syntax (feature gen_blocks) #16156 | part of rust-lang/rust-analyzer#16156
add basic supports for `gen { }` `async gen { }` `gen fn` `async gen fn`
fix some type signature show.
add some tests.
gpt 5.4 helped with some code reading.
| diff --git a/crates/hir-def/src/expr_store.rs b/crates/hir-def/src/expr_store.rs
index 62a17168b18eb..1b4de5adb51ee 100644
--- a/crates/hir-def/src/expr_store.rs
+++ b/crates/hir-def/src/expr_store.rs
@@ -644,7 +644,9 @@ impl ExpressionStore {
}
Expr::Block { statements, tail, .. }
... | 8 | 5 | 2 | [{"id": "G0", "claim": "The PR's async-block-specific naming and ClosureKind shape should be generalized to coroutines - e.g. rename ExprCollector::lower_async_block_with_moved_arguments()/async_block(), restructure hir_def::ClosureKind around a CoroutineKind (Async/Gen/AsyncGen) with Coroutine/CoroutineClosure variant... | null |
rust-lang__rust-analyzer__22003 | rust-lang/rust-analyzer | 22,003 | defect | 12e079ec6dd0b375f8adad6e996c676b12a0153d | 6685b157a35161280864ee695a90bd94bd7ea912 | fix: complete variants of hidden enums through public aliases | Fixes rust-lang/rust-analyzer#21891.
Previously, the completion engine would aggressively bail out if the parent enum was marked . This pushes the visibility check down to the individual variants so they can be properly completed when accessed via a public type alias. | diff --git a/crates/ide-completion/src/completions.rs b/crates/ide-completion/src/completions.rs
index 4a94383ff4cbd..ebe9c94d2871d 100644
--- a/crates/ide-completion/src/completions.rs
+++ b/crates/ide-completion/src/completions.rs
@@ -276,11 +276,9 @@ impl Completions {
path_ctx: &PathCompletionCtx<'_>,
... | 2 | 2 | 1 | [{"id": "G0", "claim": "The new test completes_variant_through_hidden_enum_alias is invalid because it defines and references the enum within a single crate; completion tests need to set up a separate dependency crate and reference the alias from that other crate.", "category": "testing", "verdict": "supported", "prior... | null |
rust-lang__rust-analyzer__22116 | rust-lang/rust-analyzer | 22,116 | defect | f381976fa67d9b87ca6c2ae35f8277b13013abf8 | 616f182f01576fa0831a6078e16b897bf3e127a0 | fix: mark enum variants as deprecated when their parent enum is deprecated | Closes rust-lang/rust-analyzer#22090.
- Completion items for variants of a `#[deprecated]` enum were not rendered as deprecated because `RenderContext::is_deprecated` only consulted the def's own attributes. PR rust-lang/rust-analyzer#22083 handled the trait→assoc-item propagation at the render layer.
- This ext... | diff --git a/crates/ide-completion/src/render.rs b/crates/ide-completion/src/render.rs
index 608dec1285dc..433d49820d05 100644
--- a/crates/ide-completion/src/render.rs
+++ b/crates/ide-completion/src/render.rs
@@ -120,6 +120,15 @@ impl<'a> RenderContext<'a> {
})
}
+ /// Whether an enum varia... | 1 | 1 | 0 | [{"id": "G0", "claim": "The explanatory comments inside the two new regression tests are redundant and should be removed.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-analyzer__22215 | rust-lang/rust-analyzer | 22,215 | defect | 8534be94c1292c96dc73d759c2894eeffd5ca2be | 41dbcdf2bb92836f28c106e403b67a7b96561764 | fix: Fix stack overflow on projection display | As it turns out, displaying projections can always cause an infinite loop, even when not recursing into a type param's predicates.
This does regress the previous test of infinite loops a bit, which is unfortunate. Maybe we should have a more fine-grained tracking?
Fixes rust-lang/rust-analyzer#21697. | diff --git a/crates/hir-ty/src/display.rs b/crates/hir-ty/src/display.rs
index 6bc55bc0e4731..c4f0a976e59d0 100644
--- a/crates/hir-ty/src/display.rs
+++ b/crates/hir-ty/src/display.rs
@@ -134,7 +134,15 @@ pub struct HirFormatter<'a, 'db> {
display_lifetimes: DisplayLifetime,
display_kind: DisplayKind,
d... | 2 | 2 | 0 | [{"id": "G0", "claim": "The doc-comment line added in HirFormatter starts with `//.` instead of `///` and should be fixed.", "category": "correctness", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "On a cycle, the formatter could print the projection alias without bounds as a ... | null |
rust-lang__rust-bindgen__1756 | rust-lang/rust-bindgen | 1,756 | defect | 92e8fa04206a54ab4ee07bf078e8a5f659f78040 | a5977b3f6e84296a2d69325d9eb7baecc064c78a | Sanitize RegexSet input so alternation is properly handled | Resolves #1755 by wrapping the regexes provided to a `RegexSet` in a capture group, so the added anchors work properly with alternation.
This doesn't resolve the issue of implicit/hidden regex modifications performed by this crate, which should still be properly documented. | diff --git a/src/regex_set.rs b/src/regex_set.rs
index 4e82282457..aad7b24caa 100644
--- a/src/regex_set.rs
+++ b/src/regex_set.rs
@@ -53,7 +53,7 @@ impl RegexSet {
/// Must be called before calling `matches()`, or it will always return
/// false.
pub fn build(&mut self, record_matches: bool) {
- ... | 3 | 3 | 2 | [{"id": "G0", "claim": "Add a test covering the regex-sanitization change, e.g. via a `bindgen-flags:` line in a test header.", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The change breaks a couple of existing test cases that use globs like `*` as reg... | null |
rust-lang__rust-bindgen__2084 | rust-lang/rust-bindgen | 2,084 | defect | e05a451ba704fd9e9d310c49bfac4944176b99a3 | c6cc0aa0c327e8caa9508198aa863c7a2e60ecee | Canonicalize types before looking for their definitions. | In some esoteric cases involving nested templates,
`ty.declaration().definition()` isn't enough to find the definition: we need
`ty.canonical_type().declaration().definition()` instead.
Closes #2078.
r? @emilio | diff --git a/src/ir/item.rs b/src/ir/item.rs
index 4e0ba80b42..99b15b4730 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -1594,7 +1594,7 @@ impl ClangItemParser for Item {
}
let decl = {
- let decl = ty.declaration();
+ let decl = ty.canonical_type().declaration();
... | 1 | 1 | 1 | [{"id": "G0", "claim": "One of the expected test outputs, tests/expectations/tests/layout_cmdline_token.rs, needs to be regenerated to match the binding the pull request now produces, as shown by the failing test on tests/headers/layout_cmdline_token.h.", "category": "testing", "verdict": "supported", "priority": "P0",... | null |
rust-lang__rust-bindgen__2254 | rust-lang/rust-bindgen | 2,254 | defect | 50878f37e639b8c868adec8a8c745e788c2d870a | 9a4714ad01a6c734bea8155faafce467ea460048 | Sorting the output semantically | ## Issues affected
This PR closes #1743
## Summary
This PR adds the ability to sort the output as requested in #1743. The sorting order of the output items is decided by a custom sort embedded within the `generate` function. This feature however is hidden behind an optional flag `--sort-semantically` which i... | diff --git a/Cargo.lock b/Cargo.lock
index 0c7c2f7851..fa908ea9d7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -47,6 +47,7 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
+ "syn",
"tempfile",
"which",
]
@@ -260,11 +261,11 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
... | 4 | 3 | 0 | [{"id": "G0", "claim": "Fix the typo \"scond\" in the comment explaining the two unwraps.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "End the --sort-semantically help text with a full stop for consistency with the other clap options.", "categor... | null |
rust-lang__rust-bindgen__2328 | rust-lang/rust-bindgen | 2,328 | defect | a2fe04cbafaf0c7b40979e1cc505a90d76f4d099 | 8e3f9a89e15115389fc9bfbcba7271ded674e1a1 | Implement cli option for custom derive | closes #2170 | diff --git a/bindgen-cli/options.rs b/bindgen-cli/options.rs
index 5c3960e92b..289f2a317e 100644
--- a/bindgen-cli/options.rs
+++ b/bindgen-cli/options.rs
@@ -225,6 +225,24 @@ where
"Create PartialEq implementation, if it can not be derived \
automatically.",
... | 8 | 7 | 4 | [{"id": "G0", "claim": "Registering the custom derive callback overwrites any other parse callbacks the user has set, so parse callbacks should be stored in a Vec instead.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The new CLI flags have no equivalen... | null |
rust-lang__rust-bindgen__2329 | rust-lang/rust-bindgen | 2,329 | defect | a2fe04cbafaf0c7b40979e1cc505a90d76f4d099 | 020ba8007fcde96eaf4d09fe5c575a696a617d0f | Add the `--override-abi` option | This option can be used from the CLI with the <abi>:<regex> syntax and it overrides the ABI of a function if it matches <regex>.
Fixes #2257 as the `".*"` regex can be used to match every function. | diff --git a/bindgen-cli/options.rs b/bindgen-cli/options.rs
index 5c3960e92b..bb07b49539 100644
--- a/bindgen-cli/options.rs
+++ b/bindgen-cli/options.rs
@@ -568,6 +568,12 @@ where
Arg::new("merge-extern-blocks")
.long("merge-extern-blocks")
.help("Deduplicates extern blo... | 3 | 3 | 1 | [{"id": "G0", "claim": "The `Abi::from_str` error message should maybe say `Invalid or unknown` instead of `Invalid ABI`.", "category": "documentation", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "The name passed at this call site is unnecessary and wouldn't be what you want... | null |
rust-lang__rust-bindgen__2335 | rust-lang/rust-bindgen | 2,335 | defect | bca47cd9c2e718012f7f953be25bb3a6a9ca400b | 101cde0cbbb58c82c356924e2d2b0767604acad6 | Generate extern wrappers for inlined functions | If bindgen finds a `static` or `static inline` function and the new `--wrap-static-fns` option is enabled, then:
- It will generate a new `c` source files with functions that wrap the non-external functions.
- Rename the `link_name` of the bindings generated for non-external functions so they link against the wrapp... | diff --git a/bindgen-cli/Cargo.toml b/bindgen-cli/Cargo.toml
index b900d9406d..10b4d4cd28 100644
--- a/bindgen-cli/Cargo.toml
+++ b/bindgen-cli/Cargo.toml
@@ -21,7 +21,7 @@ path = "main.rs"
name = "bindgen"
[dependencies]
-bindgen = { path = "../bindgen", version = "=0.63.0", features = ["cli"] }
+bindgen = { path ... | 18 | 15 | 9 | [{"id": "G0", "claim": "The option name `generate_extern_functions` is unfortunate and misleading since bindgen generates extern functions every time and this mode also covers non-external-linkage functions, so it should be renamed (e.g. to something like generate_non_extern_functions).", "category": "design", "verdict... | null |
rust-lang__rust-bindgen__2453 | rust-lang/rust-bindgen | 2,453 | defect | 9f2d2d3861d45ebd827466277f6843421dcaac96 | 8cb75e4dd3cad26d1a1b6a1420e9d92aa7be91e2 | Add `prettyplease` support | FIxes #2452 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a6c86b3f3..d890a95df8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -162,7 +162,9 @@
# Unreleased
## Added
-
+ * Add the `--formatter` flag with the values `none`, `rustfmt` and
+ `prettyplease` to select which tool will be used to format the bindings. The
+ def... | 2 | 2 | 1 | [{"id": "G0", "claim": "The doc-comment line `/// Whether to generate destructors.` was duplicated above `const DESTRUCTORS`.", "category": "correctness", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "In the `Prettyplease` branch the result of `prettyplease::unparse` is discar... | null |
rust-lang__rust-bindgen__2591 | rust-lang/rust-bindgen | 2,591 | defect | 1d2b579d1c3180e93089ffb1379ee11fac0cccc0 | 0505e0d417e5dc124d8d13dd18ca192f2fb9cd99 | C unwind is stable | Closes #2581 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7727787abb..ce84c24c36 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -175,6 +175,7 @@
## Changed
- The `Clone` implementation for `_BindgenUnionField` has been changed to pass
the `incorrect_clone_impl_on_copy_type` Clippy lint.
+- Mark `c_unwind` as stabilised, in ... | 3 | 3 | 2 | [{"id": "G0", "claim": "Update the c-unwind ABI override tests (c-unwind-abi-override-nightly.rs and c-unwind-abi-override.rs) so the pull request's c_unwind stabilisation can actually be tested.", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The change... | null |
rust-lang__rust-bindgen__2772 | rust-lang/rust-bindgen | 2,772 | defect | b5a6813c9a6feaeda38d7c672a1ed155f9e27266 | a19d291ffe7a423acba6714d4d56a35c5033be1d | add option to use DST structs for flex arrays | Add `--flexarray-dst` option to allow use of a dynamically sized struct to model a C flexible array member. For example, given the C struct:
```
struct msg {
unsigned int tag;
unsigned int len;
char payload[];
};
```
generate the corresponding Rust type:
```rust
#[repr(C)]
#[derive(Debug)]
pub s... | diff --git a/bindgen-cli/options.rs b/bindgen-cli/options.rs
index 66bb3f1439..7fd30821ad 100644
--- a/bindgen-cli/options.rs
+++ b/bindgen-cli/options.rs
@@ -400,6 +400,9 @@ struct BindgenCommand {
/// Wrap unsafe operations in unsafe blocks.
#[arg(long)]
wrap_unsafe_ops: bool,
+ /// Use DSTs to repr... | 5 | 5 | 2 | [{"id": "G0", "claim": "The pull request does not handle the case of a C struct pointing to a DST object (thin vs fat pointers).", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The last-field flag passed for bitfields should be `last_field && idx == ... | null |
rust-lang__rust-bindgen__3010 | rust-lang/rust-bindgen | 3,010 | defect | c4440b31ebd52bd81f0588de0d48033dc3bfc82a | be57a16f804e9a9eda30abd2de1d6526de26af9f | Improve debug str generator | Generates more optimized code per https://rust-lang.github.io/rust-clippy/master/index.html#format_collect | diff --git a/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs b/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs
index c8f19bc5af..206c3f1ae3 100644
--- a/bindgen-tests/tests/expectations/tests/derive-bitfield-method-same-name.rs
+++ b/bindgen-tests/tests/expectations... | 1 | 1 | 0 | [{"id": "G0", "claim": "An imperative approach would be clearer than the functional fold for building the debug output string.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-bindgen__3112 | rust-lang/rust-bindgen | 3,112 | defect | 03d49b6181c81ff07d709aefe966e0854197109f | 7d9b3e9e1620a023a41b858ef9d5a4132aa3c991 | Refactor enum generation | Gather all the enum variants and let the builder generate everything at once.
This allows us to simplify some logic and makes the code more readable, by putting the actual code generation close together in the build method.
For users, the main benefit is that Newtype enums now only have a single impl block, instead... | diff --git a/bindgen-tests/tests/expectations/tests/bitfield-enum-basic.rs b/bindgen-tests/tests/expectations/tests/bitfield-enum-basic.rs
index adc4690c86..aecb9dc639 100644
--- a/bindgen-tests/tests/expectations/tests/bitfield-enum-basic.rs
+++ b/bindgen-tests/tests/expectations/tests/bitfield-enum-basic.rs
@@ -1,14 ... | 8 | 8 | 0 | [{"id": "G0", "claim": "The variant enum could be named `EnumBuilderKind` instead of `EnumBuilderVariant`.", "category": "design", "verdict": "supported", "priority": "P3", "scope": "introduced"}, {"id": "G1", "claim": "The comment on `is_anonymous` should be a doc comment (`///`) like the surrounding fields.", "catego... | null |
rust-lang__rust-bindgen__3217 | rust-lang/rust-bindgen | 3,217 | defect | 1f02556afc120f24b778b4150649e221177b163f | ccc363af7a50bdce61f38afed8712f0472cd4434 | Add linux aarch64 target to ci test | I guess it should be as simple as this now that aarch64 runners have been added. | diff --git a/.github/workflows/bindgen.yml b/.github/workflows/bindgen.yml
index 1778de1d2b..bd1489911e 100644
--- a/.github/workflows/bindgen.yml
+++ b/.github/workflows/bindgen.yml
@@ -95,7 +95,7 @@ jobs:
runs-on: ${{matrix.os}}
strategy:
matrix:
- os: [ubuntu-latest, macos-latest]
+ os... | 3 | 2 | 1 | [{"id": "G0", "claim": "The new aarch64 CI run fails: test_wrap_static_fns panics with 'Cannot serialize type kind Opaque' because bindgen cannot reason about the builtin va_list in wrap-static-fns.h, and the va_list tests should be ifdeffed out with aarch64 expectations updated.", "category": "correctness", "verdict":... | null |
rust-lang__rust-bindgen__3257 | rust-lang/rust-bindgen | 3,257 | defect | de9627ffa4860c6ed56cd40470fc7a96afc09d44 | 89b43dc6297cc44b909455ef742cd5754ad2f9c1 | feat: Implement support for link type 'raw-dylib' on Windows | Hi,
I am creating a Node Addon in Rust. For several reasons, I don't want to use a sophisticated solution like napi.rs, but generate Rust bindings for the Node API using bindgen on my own.
To make it run on Windows, it is necessary to provide an import library for symbols that are resolved only at runtime (such a... | diff --git a/bindgen-tests/tests/expectations/tests/windows-raw-dylib-verbatim.rs b/bindgen-tests/tests/expectations/tests/windows-raw-dylib-verbatim.rs
new file mode 100644
index 0000000000..d2247e3523
--- /dev/null
+++ b/bindgen-tests/tests/expectations/tests/windows-raw-dylib-verbatim.rs
@@ -0,0 +1,5 @@
+# in the [yoga-rs](https://github.com/bschwind/yoga-rs) project
``... | diff --git a/bindgen-tests/tests/expectations/tests/infinite-macro.rs b/bindgen-tests/tests/expectations/tests/infinite-macro.rs
index f19879fb17..63b70a1715 100644
--- a/bindgen-tests/tests/expectations/tests/infinite-macro.rs
+++ b/bindgen-tests/tests/expectations/tests/infinite-macro.rs
@@ -1,3 +1,3 @@
#![allow(dea... | 2 | 2 | 1 | [{"id": "G0", "claim": "Add a `.hpp` test header that triggers the issue, e.g. `static const float kFoo = 1/0`, so the changed codegen path is covered.", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "It would be better to use the right type for the const... | null |
rust-lang__rust-bindgen__3301 | rust-lang/rust-bindgen | 3,301 | defect | e604f6b5d8a29391d911501054beeec52fb7c0df | d4a27566c2523bbc119eb0493734ec81d7eb58a9 | Allow constant expressions that doesn't fit in i64. | Fixes #2618 | diff --git a/bindgen-tests/tests/expectations/tests/issue-2618.rs b/bindgen-tests/tests/expectations/tests/issue-2618.rs
new file mode 100644
index 0000000000..ecac1ec81e
--- /dev/null
+++ b/bindgen-tests/tests/expectations/tests/issue-2618.rs
@@ -0,0 +1,13 @@
+#![allow(dead_code, non_snake_case, non_camel_case_types, ... | 1 | 1 | 0 | [{"id": "G0", "claim": "The reliance on `Some(value as i64)` overflowing (wrapping to a negative value) and being cast back to u64 downstream is subtle and undocumented, so comments should be added explaining it and its Rust definedness confirmed, or `as_int` restructured (e.g. an IntEvaluationResult enum).", "category... | null |
rust-lang__rust-bindgen__3307 | rust-lang/rust-bindgen | 3,307 | defect | d23fcd25854b8bfe1959538e42cd0cf5758aff9a | 5b9816fd16f1ee5c2795f12abea1e3de5e78b1ad | Add support for custom per-field attributes | This adds the ability to apply custom Rust attributes to individual
struct, union, and newtype fields in generated bindings through three
mechanisms:
1. HTML annotations in C/C++ comments:
```c
/// <div rustbindgen attribute="serde(rename = x_coord)"></div>
int x;
```
2. ParseCallbacks::field_attributes() m... | diff --git a/bindgen-tests/tests/expectations/tests/field_attr_annotation.rs b/bindgen-tests/tests/expectations/tests/field_attr_annotation.rs
new file mode 100644
index 0000000000..8db20d3ab3
--- /dev/null
+++ b/bindgen-tests/tests/expectations/tests/field_attr_annotation.rs
@@ -0,0 +1,46 @@
+#![allow(dead_code, non_s... | 1 | 1 | 0 | [{"id": "G0", "claim": "The duplicated per-field attribute collection code in codegen/mod.rs should be deduplicated into its own function (e.g. a field_attributes helper).", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-clippy__11460 | rust-lang/rust-clippy | 11,460 | defect | 3da21b089ffe8337142fc054d3230749a304d832 | 438f934f1c330cc43693a2b9ca404f3c704c2ca1 | suggest passing function instead of calling it in closure for [`option_if_let_else`] | fixes: #11429
changelog: suggest passing function instead of calling it in closure for [`option_if_let_else`]
| diff --git a/clippy_lints/src/option_if_let_else.rs b/clippy_lints/src/option_if_let_else.rs
index a7a7f4fd8fa2..156b95d644ae 100644
--- a/clippy_lints/src/option_if_let_else.rs
+++ b/clippy_lints/src/option_if_let_else.rs
@@ -165,6 +165,13 @@ fn try_get_option_occurrence<'tcx>(
}
let mut ap... | 3 | 3 | 0 | [{"id": "G0", "claim": "Rewrite the body of `try_get_argless_call_expr` as a `match` with a guard instead of the if-let chain, which may avoid a function call when `expr` is not an `ExprKind::Call` and reads more balanced.", "category": "maintainability", "verdict": "supported", "priority": "P3", "scope": "introduced"}... | null |
rust-lang__rust-clippy__11829 | rust-lang/rust-clippy | 11,829 | defect | 406d953820f48947216d6f3a31bef690d5798dca | 891846e5716be473cf03afbd38bea43812b622fc | new lint to detect infinite loop | closes: #11438
changelog: add new lint to detect infinite loop
~*I'll change the lint name*~. Should I name it `infinite_loop` or `infinite_loops` is fine? Ahhhh, English is hard... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index e74df808e064..5c62cf515593 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5147,6 +5147,7 @@ Released 2018-09-13
[`inefficient_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string
[`infallible_destructuring_match`]: https://rust-l... | 7 | 6 | 2 | [{"id": "G0", "claim": "The new lint needs at least one test covering loops that contain panic-like macro calls (todo!(), panic!(), unreachable!(), assert!()).", "category": "testing", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The leftover debug println! calls in BreakOrRe... | null |
rust-lang__rust-clippy__11853 | rust-lang/rust-clippy | 11,853 | defect | 4d563666b1e36ced2e588a92ab26288ad7daf48e | b747ee251e07739d6881468c42cf19d171059338 | expending lint [`blocks_in_if_conditions`] to check match expr as well | closes: #11814
changelog: rename lint `blocks_in_if_conditions` to [`blocks_in_conditions`] and expand it to check blocks in match scrutinees
| diff --git a/clippy_lints/src/blocks_in_if_conditions.rs b/clippy_lints/src/blocks_in_if_conditions.rs
index 28bd3fc70110..0c30e91589f1 100644
--- a/clippy_lints/src/blocks_in_if_conditions.rs
+++ b/clippy_lints/src/blocks_in_if_conditions.rs
@@ -5,7 +5,7 @@ use clippy_utils::visitors::{for_each_expr, Descend};
use cl... | 4 | 4 | 1 | [{"id": "G0", "claim": "The `format!(\"{}\", snippet_block_with_applicability(...))` call can be reduced to `snippet_block_with_applicability(...).to_string()`.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The lint's error message for `match` ... | null |
rust-lang__rust-clippy__11883 | rust-lang/rust-clippy | 11,883 | defect | 6cfbe5707546248487d09fc338598254f352edfc | 51fdafb0594fbe230336baff850701bee3ef96b5 | improve [`cast_sign_loss`], to skip warning on always positive expressions | fixes: #11642
changelog: improve [`cast_sign_loss`] to skip warning on always positive expressions
Turns out this is change became quite big, and I still can't cover all the cases, like method calls such as `POSITIVE_NUM.mul(POSITIVE_NUM)`, or `NEGATIVE_NUM.div(NEGATIVE_NUM)`... but well, if I do, I'm scared t... | diff --git a/clippy_lints/src/casts/cast_sign_loss.rs b/clippy_lints/src/casts/cast_sign_loss.rs
index bd12ee406284..b76269dfb86a 100644
--- a/clippy_lints/src/casts/cast_sign_loss.rs
+++ b/clippy_lints/src/casts/cast_sign_loss.rs
@@ -1,12 +1,14 @@
use clippy_utils::consts::{constant, Constant};
use clippy_utils::dia... | 1 | 1 | 0 | [{"id": "G0", "claim": "The pull request needs some cleanup before merge — the new lint code still carries leftover working notes, notably the planning/TODO comment block marked \"(Remove after final code review)\", which should be removed.", "category": "maintainability", "verdict": "supported", "priority": "P2", "sco... | null |
rust-lang__rust-clippy__12122 | rust-lang/rust-clippy | 12,122 | defect | e89968425495ad99ce16bd00a6d7a3f63648271b | 1243ba341e1c022b16597d92f527616886fcd9c0 | add to_string_trait_impl lint | closes #12076
changelog: [`to_string_trait_impl`]: add lint for direct `ToString` implementations | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4d32bbec914a..cc8f77cb106e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5625,6 +5625,7 @@ Released 2018-09-13
[`too_many_arguments`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
[`too_many_lines`]: https://rust-lang.github.io/rust-cli... | 8 | 5 | 4 | [{"id": "G0", "claim": "Unrelated UI tests get errors because of the new lint and need suitable `#![allow(..)]` annotations.", "category": "testing", "verdict": "supported", "priority": "P0", "scope": "introduced"}, {"id": "G1", "claim": "The lint may produce false positives for types that one may want to convert to a ... | null |
rust-lang__rust-clippy__12713 | rust-lang/rust-clippy | 12,713 | defect | b2a7371aaad1d1a25c6c6ac83c5937a1c31ac7bc | d86cbc3bc01109806c78eaf02a196850a79cca1c | make sure the msrv for `const_raw_ptr_deref` is met when linting [`missing_const_for_fn`] | fixes: #8864
---
changelog: make sure the msrv for `const_ptr_deref` is met when linting [`missing_const_for_fn`]
| diff --git a/clippy_config/src/msrvs.rs b/clippy_config/src/msrvs.rs
index 59dd5b334b84..a28fdb7cbefc 100644
--- a/clippy_config/src/msrvs.rs
+++ b/clippy_config/src/msrvs.rs
@@ -26,7 +26,7 @@ msrv_aliases! {
1,63,0 { ASSIGNING_CLONES }
1,62,0 { BOOL_THEN_SOME, DEFAULT_ENUM_ATTRIBUTE }
1,59,0 { THREAD_LO... | 1 | 1 | 0 | [{"id": "G0", "claim": "The raw-pointer-deref MSRV skip logic added in missing_const_for_fn should instead live in is_min_const_fn (e.g. a ProjectionElem::Deref arm in check_place in qualify_min_const_fn), since other lints also rely on is_min_const_fn and e.g. a thread_local with a raw pointer deref likely cannot be c... | null |
rust-lang__rust-clippy__12842 | rust-lang/rust-clippy | 12,842 | defect | 05c40536285245d31f2bd6ed43c5bc43cc768752 | ecc2f431b351e4bc7450337e6db7487bc557df2a | add parentheses to [`let_and_return`]'s suggestion | closes: #12801
---
changelog: suggest adding parentheses when linting [`let_and_return`] and [`needless_return`]
| diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs
index e8f9d4381047..f4164b3f221d 100644
--- a/clippy_lints/src/returns.rs
+++ b/clippy_lints/src/returns.rs
@@ -243,11 +243,9 @@ impl<'tcx> LateLintPass<'tcx> for Return {
|err| {
err.span_label(local.span, "unn... | 2 | 2 | 0 | [{"id": "G0", "claim": "Using Sugg::maybe_par adds unnecessary parentheses to suggested code (e.g. `(FN() + 1)`), and the author asks whether parentheses should be emitted only when the binary operands are considered complex.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id... | null |
rust-lang__rust-clippy__12971 | rust-lang/rust-clippy | 12,971 | defect | 3e84ca8ac95623bc5a36886873b12bd95fd8f700 | faeed5b2f65e1025d171cc581e3fbfed6d99a70c | `empty_enum_variants_with_brackets`: Do not lint reachable enums and enum variants used as functions in the same crate | Fixes #12551
changelog: [`empty_enum_variants_with_brackets`]: Do not lint reachable enums or enums which are used as functions within the same crate.
r? @xFrednet | diff --git a/clippy_lints/src/empty_with_brackets.rs b/clippy_lints/src/empty_with_brackets.rs
index 745599b0e57a..265a67ee6a6c 100644
--- a/clippy_lints/src/empty_with_brackets.rs
+++ b/clippy_lints/src/empty_with_brackets.rs
@@ -1,10 +1,15 @@
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::sour... | 10 | 9 | 4 | [{"id": "G0", "claim": "The two FxHashSets tracking variant usage should be one map from DefId to a Used/Unused state, and it should be an ordered FxIndex{Map,Set} so diagnostics keep a consistent order and the tests cannot randomly fail.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "intro... | null |
rust-lang__rust-clippy__13294 | rust-lang/rust-clippy | 13,294 | defect | e5a1ef0795a119a68cbd4cccb41b569206d74d78 | 3993dbdf95a9cfae829bb06a44d14ebfecb275e5 | Add new lint: `used_underscore_items` | Closes #13260
---
changelog: new [`used_underscore_items`] lint against using items with a single leading underscore
| diff --git a/CHANGELOG.md b/CHANGELOG.md
index fddc2fd994e8..2ba323997cf5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6012,6 +6012,7 @@ Released 2018-09-13
[`use_debug`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_debug
[`use_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#us... | 2 | 2 | 1 | [{"id": "G0", "claim": "The lint message is too long for something so insignificant; shorten the first part to \"used underscore-prefixed item\", drop the second sentence, and do not repeat the name since the span of the path is shown.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": ... | null |
rust-lang__rust-clippy__13324 | rust-lang/rust-clippy | 13,324 | defect | b86a202c92aec56daa3eee677bbc70493ac10394 | 04d70d04fcf9412d7006ee4646f56f8bf5f2149f | [`single_match`, `single_match_else`] fix suggestion when match irrefutable | fixes #13012
changelog:[`single_match`, `single_match_else`]: fix suggestion when `match` irrefutable
| diff --git a/clippy_lints/src/matches/single_match.rs b/clippy_lints/src/matches/single_match.rs
index b6930f7b9d10..4bd46bced38e 100644
--- a/clippy_lints/src/matches/single_match.rs
+++ b/clippy_lints/src/matches/single_match.rs
@@ -91,6 +91,13 @@ fn report_single_pattern(cx: &LateContext<'_>, ex: &Expr<'_>, arm: &Ar... | 1 | 1 | 0 | [{"id": "G0", "claim": "For the match arm body at tests/ui/single_match.fixed line 309, the suggestion could be emitted as a plain expression instead of a block.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-clippy__13435 | rust-lang/rust-clippy | 13,435 | defect | 0e1ded0f8d9cdfb5e15c2e1bb4f0b78c48a8aded | 97c4bfb5cb5cac78e2087dd9582c6cd681cc1bd1 | new lint: `char_indices_as_byte_indices` | Closes #10202.
This adds a new lint that checks for uses of the `.chars().enumerate()` position in a context where a byte index is required and suggests changing it to use `.char_indices()` instead.
I'm planning to extend this lint to also detect uses of the position in iterator chains, e.g. `s.chars().enumerate(... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e0aaa25a7c8..7d5b4071b304 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5352,6 +5352,7 @@ Released 2018-09-13
[`cast_slice_from_raw_parts`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_from_raw_parts
[`cfg_not_test`]: https://rust-lang.github... | 6 | 3 | 0 | [{"id": "G0", "claim": "The lint should identify `.chars()` via the `str::chars` diagnostic item instead of matching the method name as a string, but the pinned nightly does not have that diagnostic item yet.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1",... | null |
rust-lang__rust-clippy__13608 | rust-lang/rust-clippy | 13,608 | defect | 9cf416dc6ec9d7ebc8df299ca970e4a92efa2596 | c4815aeef10b347c4491a0a4d4087f9750773e70 | [`infinite_loops`]: fix incorrect suggestions on async functions/closures | closes: #12338
I intend to fix this in #12421 but got distracted by some other problems in the same lint, delaying the process of closing the actual issue. So here's a separated PR that only focus on the issue and nothing else.
---
changelog: [`infinite_loops`]: fix suggestion error on async functions/closures... | diff --git a/clippy_lints/src/loops/infinite_loop.rs b/clippy_lints/src/loops/infinite_loop.rs
index e25c03db5344..e2d986d2d81e 100644
--- a/clippy_lints/src/loops/infinite_loop.rs
+++ b/clippy_lints/src/loops/infinite_loop.rs
@@ -1,12 +1,13 @@
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::{fn_... | 1 | 1 | 0 | [{"id": "G0", "claim": "Fix the grammar in the `is_never_return` doc comment: \"This function also take care of return type of async fn,\" should read \"also takes care of the return type of async fn,\".", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-clippy__13829 | rust-lang/rust-clippy | 13,829 | defect | f2aed50873e8e908119044c283c33cf6ef0b66e0 | b92d91b359cd63f4fe9144a54a92008a0bf61334 | Add new `useless_concat` lint | Fixes #13793.
Interestingly enough, to actually check that the macro call has at least two arguments, we need to use the rust lexer after getting the original source code snippet.
changelog: Add new `useless_concat` lint | diff --git a/CHANGELOG.md b/CHANGELOG.md
index cc966972939a..88037208cadb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6170,6 +6170,7 @@ Released 2018-09-13
[`used_underscore_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_items
[`useless_asref`]: https://rust-lang.github.io/rus... | 7 | 6 | 2 | [{"id": "G0", "claim": "Move the hardcoded [\"core\", \"macros\", \"builtin\", \"concat\"] path into clippy_utils::paths so all hardcoded paths live in one place.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "Declare the lint under the complexi... | null |
rust-lang__rust-clippy__13888 | rust-lang/rust-clippy | 13,888 | defect | 998c7801260007b8e36fe8749f3c90b25b3e4df3 | 0ed8bdd2fc81bb864f48db9eb46c7b9a4dd4a913 | fix: `undocumented_unsafe_blocks` FP on trait/impl items | fixes #11709
Continuation of #12672. r? @Alexendoo if you don't mind?
changelog: [`undocumented_unsafe_blocks`] fix FP on trait/impl items
| diff --git a/clippy_lints/src/undocumented_unsafe_blocks.rs b/clippy_lints/src/undocumented_unsafe_blocks.rs
index 45d730985bb1..01ad60aab4b4 100644
--- a/clippy_lints/src/undocumented_unsafe_blocks.rs
+++ b/clippy_lints/src/undocumented_unsafe_blocks.rs
@@ -351,12 +351,13 @@ fn block_parents_have_safety_comment(
... | 2 | 1 | 1 | [{"id": "G0", "claim": "After the update, clippy would now emit `undocumented_unsafe_blocks` on code in time-rs (offset_date_time.rs line 35) that it did not lint before — a lint regression — and the reviewer asks the author to look at it and add a test.", "category": "correctness", "verdict": "supported", "priority": ... | null |
rust-lang__rust-clippy__13889 | rust-lang/rust-clippy | 13,889 | defect | 998c7801260007b8e36fe8749f3c90b25b3e4df3 | e6044a5dcf2b8c31aa3a56fdff70dcd16c447f5e | fix: `manual_unwrap_or_default` suggests falsely when condition type is uncertain | fixes #12670
Continuation of #12688. r? @Jarcho if you don't mind?
changelog: [`manual_unwrap_or_default`] fix wrong suggestions when condition type is uncertain
| diff --git a/clippy_lints/src/manual_unwrap_or_default.rs b/clippy_lints/src/manual_unwrap_or_default.rs
index 8f8390b6f3f9..32f9e9bce1b0 100644
--- a/clippy_lints/src/manual_unwrap_or_default.rs
+++ b/clippy_lints/src/manual_unwrap_or_default.rs
@@ -9,8 +9,8 @@ use rustc_span::sym;
use clippy_utils::diagnostics::span... | 1 | 1 | 0 | [{"id": "G0", "claim": "The suggestion message should read \"ascribe the type\" instead of the ungrammatical \"explicit the type\" (or alternatively use a multispan suggestion on the let pattern).", "category": "correctness", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-clippy__14046 | rust-lang/rust-clippy | 14,046 | defect | 1cb4236a95b7ecd10b01d91e598bfd7f6c5188ad | b6a3a7556eb67814167202882ac075978e901913 | New lint: `swap_with_temporary` | This lint detects inefficient or useless `{std,core}::mem::swap()` calls such as:
```rust
// Should be `a = temp();`
swap(&mut a, &mut temp());
// Should be `*b = temp();`
swap(b, &mut temp());
// Should be `temp1(); temp2();` if we want to keep the side effects
swap(&mut temp1(), &mut ... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2d37e0da37f0..337b0f1fcdcf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6106,6 +6106,7 @@ Released 2018-09-13
[`suspicious_unary_op_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_unary_op_formatting
[`suspicious_xor_used_as_pow`]: ... | 8 | 8 | 0 | [{"id": "G0", "claim": "Not linting arguments that come from macro expansion prevents useful lints like `swap(&mut v, &mut vec![1])`, and the reviewer asks whether any real false-positive cases justify the restriction.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1"... | null |
rust-lang__rust-clippy__14107 | rust-lang/rust-clippy | 14,107 | defect | ad05bc055c0580c87af7a3306e865a38a8e307bc | 604b1c8cf1f9399fd5d669d3b583ece6b9e163a5 | add `manual_dangling_ptr` lint | close #2177
changelog: [`manual_dangling_ptr`]: new lint
| diff --git a/CHANGELOG.md b/CHANGELOG.md
index bc42c07224e1..449d7c21ee2d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5501,6 +5501,7 @@ Released 2018-09-13
[`create_dir`]: https://rust-lang.github.io/rust-clippy/master/index.html#create_dir
[`crosspointer_transmute`]: https://rust-lang.github.io/rust-clippy/mast... | 11 | 9 | 2 | [{"id": "G0", "claim": "The new lint needs to check MSRV, since ptr::dangling* was only stabilized in Rust 1.84.", "category": "correctness", "verdict": "uncertain", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The test case `let z = 1; let _ = z as *const usize;` needs a decision on how it should b... | null |
rust-lang__rust-clippy__14109 | rust-lang/rust-clippy | 14,109 | defect | ad05bc055c0580c87af7a3306e865a38a8e307bc | b25b8ad24dba45e613a589cd1fd01cf38377e7c0 | fn_to_numeric_cast_any: Do not warn cast to raw pointer | Fixes #12638
changelog: [`fn_to_numeric_cast_any`]: Fix false positive on a cast to raw pointer
| diff --git a/clippy_lints/src/casts/fn_to_numeric_cast_any.rs b/clippy_lints/src/casts/fn_to_numeric_cast_any.rs
index b22e8f4ee891..6e8347a54db6 100644
--- a/clippy_lints/src/casts/fn_to_numeric_cast_any.rs
+++ b/clippy_lints/src/casts/fn_to_numeric_cast_any.rs
@@ -8,12 +8,7 @@ use rustc_middle::ty::{self, Ty};
use s... | 2 | 1 | 0 | [{"id": "G0", "claim": "The added `assert!(cast_to.is_numeric())` in fn_to_numeric_cast_any::check is a leftover and should be removed: Clippy does not use assert!() in its own code, and the lint is now only called with numeric cast targets anyway.", "category": "maintainability", "verdict": "supported", "priority": "P... | null |
rust-lang__rust-clippy__14151 | rust-lang/rust-clippy | 14,151 | defect | e6d96412723a9d8187931116df08581de70f0bc9 | 5e9ccce830a4a8514fd2565811e58ed9649f1105 | fix: `map_entry` FP on struct member | fixes #13934
I modified the part for checking if the map is used so that it can check field and index exprs.
changelog: [`map_entry`]: fix FP on struct member
| diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs
index 2bec4f2f99e5..e8e6f666fe9e 100644
--- a/clippy_lints/src/entry.rs
+++ b/clippy_lints/src/entry.rs
@@ -500,7 +500,7 @@ impl<'tcx> Visitor<'tcx> for InsertSearcher<'_, 'tcx> {
self.visit_non_tail_expr(insert_expr.value);
... | 2 | 2 | 0 | [{"id": "G0", "claim": "Refactor `is_map_or_parent_used` to use `for_each_expr` instead of the `||` recursion, which is clever but hard to read.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "Document the function, whose name left the reviewer u... | null |
rust-lang__rust-clippy__14158 | rust-lang/rust-clippy | 14,158 | defect | 390286d6643f8ca3ecc55f389033bcbe6d4d45cf | a0927f92c9d321c27ec2902ad351e54f244de6fd | question_mark: avoid incorrect suggestion when `ref` binding used | changelog: [`question_mark`]: avoid incorrect suggestion when `ref` binding used
Fixes #13417
| diff --git a/clippy_lints/src/question_mark.rs b/clippy_lints/src/question_mark.rs
index ffc3b86c502e..94142c407bbe 100644
--- a/clippy_lints/src/question_mark.rs
+++ b/clippy_lints/src/question_mark.rs
@@ -145,8 +145,42 @@ fn check_let_some_else_return_none(cx: &LateContext<'_>, stmt: &Stmt<'_>) {
{
let ... | 1 | 1 | 0 | [{"id": "G0", "claim": "The suggestion-building code added in clippy_lints/src/question_mark.rs is seriously hard to read and should be made more readable — via renaming, light comments and some spacing, or by extracting it into a function such as `build_suggestion`.", "category": "maintainability", "verdict": "support... | null |
rust-lang__rust-clippy__14169 | rust-lang/rust-clippy | 14,169 | defect | 4a94ad6c5233ae51865a2dad0068bbfe60daed45 | ce9ae6f7f453bfd75ddbd808133c56e330ade96c | fix suggestion for assignments have enclosing parentheses under `needless_late_init` | fixes #9895
changelog: [`needless_late_init`]: correct suggestion when assignments have enclosing parentheses
| diff --git a/clippy_lints/src/needless_late_init.rs b/clippy_lints/src/needless_late_init.rs
index 4e19a2f409dd..5ac1027a1d73 100644
--- a/clippy_lints/src/needless_late_init.rs
+++ b/clippy_lints/src/needless_late_init.rs
@@ -1,6 +1,7 @@
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::path_to_lo... | 2 | 2 | 0 | [{"id": "G0", "claim": "Use the newer non-allocating source checking API (`check_source_text`) instead of `snippet` when testing for enclosing parentheses.", "category": "performance", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The `if` expression choosing between a span bu... | null |
rust-lang__rust-clippy__14209 | rust-lang/rust-clippy | 14,209 | defect | cee9abf10c28711e9a18cf54a5d89b7b5e92f558 | ad78ce0f650745bd825901a28045c65f34cd72fb | fix: `option_if_let_else` FP when value partially moved | fixes #13964
The lint `option_map_unwrap_or` used to have a similar issue in #10579, so I borrowed its solution to fix this one.
changelog: [`option_if_let_else`]: fix FP when value partially moved
| diff --git a/clippy_lints/src/option_if_let_else.rs b/clippy_lints/src/option_if_let_else.rs
index de9f055863cb..3c324eebe0bc 100644
--- a/clippy_lints/src/option_if_let_else.rs
+++ b/clippy_lints/src/option_if_let_else.rs
@@ -1,16 +1,23 @@
+use std::ops::ControlFlow;
+
use clippy_utils::diagnostics::span_lint_and_sug... | 2 | 2 | 1 | [{"id": "G0", "claim": "The new ConditionVisitor and ReferenceVisitor structs should be documented with doc comments.", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The change is suppressing a large number of real positives in lintcheck, so the ne... | null |
rust-lang__rust-clippy__14237 | rust-lang/rust-clippy | 14,237 | defect | 0f20a12ad4ae1958c941c5d5b5d0ea188f625043 | af8c3b694e46c4b3577c6f4b812d7eca20d15100 | fix: `redundant_clone` FP in overlapping lifetime | fixes #13900
changelog: [`redundant_clone`]: fix FP in overlapping lifetime
| diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs
index fb1bc494bd94..e49cb272bdb3 100644
--- a/clippy_lints/src/redundant_clone.rs
+++ b/clippy_lints/src/redundant_clone.rs
@@ -183,14 +183,24 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone {
let clone_usage = if lo... | 1 | 1 | 0 | [{"id": "G0", "claim": "Adding cloned_use_loc makes the cloned_used field redundant and its doc comment contradictory or incomplete, so cloned_used should be removed.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-clippy__14307 | rust-lang/rust-clippy | 14,307 | defect | 52bf26e9ad2891fda366d2e7e90bbe96be0715e5 | 363c2829353712fd6e8d850e5a867df27b035b0e | fix: `map_entry` FP inside closure | Closes #11976
changelog: [`map_entry`]: fix FP inside closure
| diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs
index f8a5cf53cda0..1e0f2316eee7 100644
--- a/clippy_lints/src/entry.rs
+++ b/clippy_lints/src/entry.rs
@@ -8,7 +8,7 @@ use clippy_utils::{
use core::fmt::{self, Write};
use rustc_errors::Applicability;
use rustc_hir::hir_id::HirIdSet;
-use rustc_hir... | 1 | 1 | 1 | [{"id": "G0", "claim": "The added `self.is_single_insert = false;` in the Closure arm of `InsertSearcher::visit_expr` is unnecessary and unjustified, since omitting it (or even setting it to `true`) still passes all the existing UI tests, so the author is asked for a UI test that would show a different message without ... | null |
rust-lang__rust-clippy__14358 | rust-lang/rust-clippy | 14,358 | defect | 81643e297cf44ce3c7648b8443fc4d6592fa81eb | 79f79f78f240949d7175563663950c51ee433274 | suggest `is_some_and` instead of `map_or` in `case_sensitive_file_extension_comparions` | close #14357
changelog: [`case_sensitive_file_extension_comparisons`]: suggest `is_some_and` to suppress other lint warnings
| diff --git a/clippy_lints/src/methods/case_sensitive_file_extension_comparisons.rs b/clippy_lints/src/methods/case_sensitive_file_extension_comparisons.rs
index 18568e3661fe..74357170ada5 100644
--- a/clippy_lints/src/methods/case_sensitive_file_extension_comparisons.rs
+++ b/clippy_lints/src/methods/case_sensitive_fil... | 1 | 1 | 1 | [{"id": "G0", "claim": "The change raises the lint's MSRV from 1.0.0 to 1.70.0, and since the MSRV should not be bumped just for the suggestion the `is_some_and` suggestion should only apply when the MSRV is >1.70.0.", "category": "design", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
rust-lang__rust-clippy__14361 | rust-lang/rust-clippy | 14,361 | defect | 81643e297cf44ce3c7648b8443fc4d6592fa81eb | 5edcbbb7e99451fee63772cddde3c07a7c0559f6 | extend `needless_collect` | changelog: [`needless_collect`]: extend needless_collect to lint more cases
Fix #14350
| diff --git a/clippy_lints/src/methods/needless_collect.rs b/clippy_lints/src/methods/needless_collect.rs
index 56ff7e2c61b2..8a6e6841e3af 100644
--- a/clippy_lints/src/methods/needless_collect.rs
+++ b/clippy_lints/src/methods/needless_collect.rs
@@ -23,6 +23,7 @@ use rustc_span::{Span, sym};
const NEEDLESS_COLLECT_... | 3 | 3 | 1 | [{"id": "G0", "claim": "The suggestion in the new index branch should not be `MachineApplicable`, since replacing the indexed collect with `nth().unwrap()` changes semantics when the iterator has side effects (the iterator is no longer exhausted to the end).", "category": "correctness", "verdict": "supported", "priorit... | null |
rust-lang__rust-clippy__14367 | rust-lang/rust-clippy | 14,367 | defect | cee9abf10c28711e9a18cf54a5d89b7b5e92f558 | 253d6eb03422b06ac9d1faae34c3b073bed67ca7 | Correctly handle bracketed type in `default_constructed_unit_struct` | There were two bugs here. Let's assume `T` is a singleton type implementing `Default` and that `f()` takes a `T`:
- `f(<T>::default())` cannot be replaced by `f(<T)` as it was (incorrect spans – this is tricky because the type relative path uses a base span covering only `T`, not `<T>`) (third commit)
- The argumen... | diff --git a/clippy_lints/src/default_constructed_unit_structs.rs b/clippy_lints/src/default_constructed_unit_structs.rs
index bbd5dc15542d..f99b799c0440 100644
--- a/clippy_lints/src/default_constructed_unit_structs.rs
+++ b/clippy_lints/src/default_constructed_unit_structs.rs
@@ -1,5 +1,6 @@
-use clippy_utils::diagno... | 1 | 1 | 0 | [{"id": "G0", "claim": "A `dbg!` debug macro was left behind in the new source-text check in clippy_lints/src/default_constructed_unit_structs.rs and should be removed; clippy_lints dogfood could also run with `-Dclippy::dbg_macro` to catch this in the future.", "category": "maintainability", "verdict": "supported", "p... | null |
rust-lang__rust-clippy__14371 | rust-lang/rust-clippy | 14,371 | defect | cee9abf10c28711e9a18cf54a5d89b7b5e92f558 | bc0f2cf1404922188e1798b5ba48836b7b8e3028 | fix: `unnecessary_safety_comment` FP on desugared assign | Closes #13039
changelog: [`unnecessary_safety_comment`]: fix FP on desugared assign
| diff --git a/clippy_lints/src/undocumented_unsafe_blocks.rs b/clippy_lints/src/undocumented_unsafe_blocks.rs
index b824eb88abf9..816e400ed840 100644
--- a/clippy_lints/src/undocumented_unsafe_blocks.rs
+++ b/clippy_lints/src/undocumented_unsafe_blocks.rs
@@ -312,6 +312,25 @@ fn expr_has_unnecessary_safety_comment<'tcx>... | 1 | 1 | 0 | [{"id": "G0", "claim": "The regression-test SAFETY comments are wrong: the second case (`_ = bar()`) is not an incorrect trigger and the wording should be past tense now that it is fixed.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
rust-lang__rust-clippy__14389 | rust-lang/rust-clippy | 14,389 | defect | a25cbd50ca170d59b187b2a8e56cb33470e524eb | b26706ebaa9d26329e077fc18ca0bb6eb499af72 | fix: `option_if_let_else` suggests wrongly when coercion requires explicit cast | Closes #11059
changelog: `option_if_let_else`: fix wrong suggestion when coersion requires explicit cast
| diff --git a/clippy_lints/src/option_if_let_else.rs b/clippy_lints/src/option_if_let_else.rs
index de9f055863cb..d42ee5f3a934 100644
--- a/clippy_lints/src/option_if_let_else.rs
+++ b/clippy_lints/src/option_if_let_else.rs
@@ -11,6 +11,7 @@ use rustc_hir::{
Arm, BindingMode, Expr, ExprKind, MatchSource, Mutability... | 2 | 1 | 1 | [{"id": "G0", "claim": "The Unsize-only check fixes only part of the problem: for a static String coerced via deref (e.g. `&S` in the `None` arm) the lint still produces a bad suggestion.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G3", "claim": "The typo \"coe... | null |
rust-lang__rust-clippy__14397 | rust-lang/rust-clippy | 14,397 | defect | bb0d09b220dc94fa956d59b395c825b217a8070e | a7edf7df4d691468422d44356c6f010a3384f46d | Validate paths in `disallowed_*` configurations | This PR resolves #11432 by checking that paths resolve in `disallowed_*` configurations.
It also does some lightweight validation of definition kinds. For example, only paths that resolve to `DefKind::Macro` definitions are allowed in `disallowed_macro` configurations.
~The PR is currently two commits. The first ... | diff --git a/clippy.toml b/clippy.toml
index 77573105d86a..0a7724bbe4e6 100644
--- a/clippy.toml
+++ b/clippy.toml
@@ -7,11 +7,14 @@ lint-commented-code = true
[[disallowed-methods]]
path = "rustc_lint::context::LintContext::lint"
reason = "this function does not add a link to our documentation, please use the `clip... | 9 | 7 | 0 | [{"id": "G0", "claim": "The config-validation warning text \"`{path}` is invalid\" is vague and should say something along the lines of \"does not designate an existing item\".", "category": "documentation", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "`reses` might be an eas... | null |
rust-lang__rust-clippy__14401 | rust-lang/rust-clippy | 14,401 | defect | 18061e2c42c719d0d483b9bebdc853ec189ba121 | 1bf880949fe5d886a0fe1810bc62a11eb7bff572 | fix: `unnested_or_patterns` suggests wrongly in `let` | Closes #9952
changelog: [`unnested_or_patterns`] fix wrong suggestion in `let`
| diff --git a/clippy_lints/src/unnested_or_patterns.rs b/clippy_lints/src/unnested_or_patterns.rs
index f43715d6752e..196fb4dc8814 100644
--- a/clippy_lints/src/unnested_or_patterns.rs
+++ b/clippy_lints/src/unnested_or_patterns.rs
@@ -64,34 +64,46 @@ impl_lint_pass!(UnnestedOrPatterns => [UNNESTED_OR_PATTERNS]);
impl ... | 1 | 1 | 1 | [{"id": "G0", "claim": "Fix the parens-removal visitor to leave the outermost pattern's parens in place instead of introducing PatternSource, since the pull request's approach also drops the user's outermost parens, which is not what the lint advertises and might be considered redundant with rustc's unused_parens lint.... | null |
rust-lang__rust-clippy__14405 | rust-lang/rust-clippy | 14,405 | defect | f85331f4d1efc2878b3ad8bdf5d2ac73fbe0eb2e | 4427dfebdcacd4f2c9ddfb6012012d124a14d66f | fix: `manual_find` suggests wrongly when early return | Closes #9521
changelog: [`manual_find`]: fix wrong suggestions when early return
| diff --git a/clippy_lints/src/loops/manual_find.rs b/clippy_lints/src/loops/manual_find.rs
index aa8a2934f89b..29f2c70ba116 100644
--- a/clippy_lints/src/loops/manual_find.rs
+++ b/clippy_lints/src/loops/manual_find.rs
@@ -3,7 +3,7 @@ use super::utils::make_iterator_snippet;
use clippy_utils::diagnostics::span_lint_an... | 1 | 1 | 1 | [{"id": "G0", "claim": "The new guard `!contains_return(cond)` should also protect against other diverging paths in the condition, such as `break` and `continue`, by using `contains_return_break_continue_macro(cond)` instead.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}] | null |
rust-lang__rust-clippy__14420 | rust-lang/rust-clippy | 14,420 | defect | 775a5c27123414c11376778f090f167831259ce8 | 5a2d393a9cc538dca446b75f1daa3e34351d3056 | Reinstate `single_match`/`single_match_else` lints with comments | Commit efe3fe9b8c5f16bbf39af7415bbde9441bc54dbb removed the ability for `single_match` and `single_match_else` to trigger if comments were present outside of the arms, as those comments would be lost while rewriting the `match` expression.
This reinstates the lint, but prevents the suggestion from being applied auto... | diff --git a/clippy_lints/src/matches/mod.rs b/clippy_lints/src/matches/mod.rs
index 35caa7d1f3a6..2b9173e6f412 100644
--- a/clippy_lints/src/matches/mod.rs
+++ b/clippy_lints/src/matches/mod.rs
@@ -1110,11 +1110,9 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
}
}
... | 2 | 1 | 0 | [{"id": "G0", "claim": "Although the suggestion is downgraded to Applicability::MaybeIncorrect when comments are present, it is still applied, so the .fixed output swallows the comments the PR set out to preserve.", "category": "correctness", "verdict": "uncertain", "priority": "P1", "scope": "introduced"}, {"id": "G1"... | null |
rust-lang__rust-clippy__14424 | rust-lang/rust-clippy | 14,424 | defect | 48005578576c7820590f680b92f5f6213b9165f5 | 247ad0fe1cbf2a93dca79c8e97ecb33a4029c95b | fix: `nonminimal_bool` wrongly showed the macro definition | Closes #14404
changelog: [`nonminimal_bool`]: fix macro definition wrongly showed in suggestions.
| diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs
index 48b5d4da8886..c77fe51a765a 100644
--- a/clippy_lints/src/booleans.rs
+++ b/clippy_lints/src/booleans.rs
@@ -350,8 +350,14 @@ impl SuggestContext<'_, '_, '_> {
self.output.push_str(&str);
} else {... | 1 | 1 | 0 | [{"id": "G0", "claim": "The `!` handling can be made simpler by always requiring the root context via Sugg::hir_with_context (and letting Sugg invert the condition itself) instead of the from_expansion/source_callsite branch.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduce... | null |
rust-lang__rust-clippy__14433 | rust-lang/rust-clippy | 14,433 | defect | a422d9e68c4b4504da213beb7baff0cb93b66d15 | 27d69af1dbd82937b2350f2a65f8e0dabde946e6 | Various improvements to the `incompatible_msrv` lint | This PR supersedes #14328 following the [2025-03-18 Clippy meeting discussion](https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/Meeting.202025-03-18/with/506527762). It uses a simpler approach than what was proposed initially in #14328 and does not add new options.
First, it documents how `cfg_att... | diff --git a/clippy_lints/src/incompatible_msrv.rs b/clippy_lints/src/incompatible_msrv.rs
index e55edb1fcaa8..f5e3a17e4cec 100644
--- a/clippy_lints/src/incompatible_msrv.rs
+++ b/clippy_lints/src/incompatible_msrv.rs
@@ -1,8 +1,8 @@
use clippy_config::Conf;
-use clippy_utils::diagnostics::span_lint;
+use clippy_util... | 2 | 2 | 0 | [{"id": "G0", "claim": "The cache should not be typed as `Option<RustcVersion>`; Centri3 suggests an explicit enum (after first suggesting `OnceCell`) to make the checked/feature-enabled distinction clearer.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": ... | null |
rust-lang__rust-clippy__14453 | rust-lang/rust-clippy | 14,453 | defect | c033a4c741bc7e8db0ffa49c110377f602d5c61c | 4cddeee969dd681ecf8c6a0d2ebfa3351546b5dc | add allow_unused config to missing_docs_in_private_items | fixes #14413
add allow_unused config to missing_docs_in_private_items for underscored field
changelog: [`missing_docs_in_private_items`]: add allow_unused config to missing_docs_in_private_items for underscored field
Explaination (quoted from the issue's author): When writing structures that must adhere to a ... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d00638f2ee7..02d7276fe651 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6372,6 +6372,7 @@ Released 2018-09-13
[`max-suggested-slice-pattern-length`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-suggested-slice-pattern-length
[`max-trait-bounds`]: htt... | 3 | 3 | 0 | [{"id": "G0", "claim": "Group the underscore-skip condition with the other conditions and keep only one exit point in check_field_def, adjusting self.prev_span on all paths before leaving.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The new d... | null |
rust-lang__rust-clippy__14463 | rust-lang/rust-clippy | 14,463 | defect | 97bb0639585096faa050b80a289836e46ddc3210 | 9659649ea687c52418a19634b6edc3cfa01656a9 | Various fixes for `manual_is_power_of_two` | Fix #14461:
- insert parentheses as required in suggestion
- check MSRV before suggesting fix in `const` context
- do not lint macro expansion result
Commits have been logically separated to facilitate review, and start with a refactoring (and simplification) of the existing code.
changelog: [`manual_is_powe... | diff --git a/book/src/lint_configuration.md b/book/src/lint_configuration.md
index a677745379c2..77de05d2d344 100644
--- a/book/src/lint_configuration.md
+++ b/book/src/lint_configuration.md
@@ -804,6 +804,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
* [`manual_flatten`](https:... | 2 | 2 | 1 | [{"id": "G0", "claim": "The lint could also recognize `<int>::count_ones(x)` written as a normal `ExprKind::Call`, not just the method-call form.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The `op.node == BinOpKind::Sub` check could be moved abo... | null |
rust-lang__rust-clippy__14471 | rust-lang/rust-clippy | 14,471 | defect | f5d81a314a5765be237f716dca2b0ea42f460095 | 15560d1ad647077ff66644a90eba890810d20f86 | Consider nested lifetimes in `mut_from_ref` | fixes #7749.
This issue proposes searching for `DerefMut` impls, which is not done here: every lifetime parameter (aka `<'a>`) is the input types is considered to be potentially mutable, and thus deactivates the lint.
changelog: [`mut_from_ref`]: Fixes false positive, where lifetimes nested in the type (e.g. `Box<&... | diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs
index 55f1ece05593..ddae9d2e12b1 100644
--- a/clippy_lints/src/ptr.rs
+++ b/clippy_lints/src/ptr.rs
@@ -569,17 +569,19 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
}
fn check_mut_from_ref<'tcx>(cx: &LateContext<'tcx>, sig: &FnSig<'_>, body: Option<&Body<'tcx>>)... | 3 | 1 | 0 | [{"id": "G0", "claim": "The function's name is not clear enough and it lacks documentation; the reviewer asks for a clearer name such as get_ref_lifetime_mutability.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "If only Some(Mutability::Mut/Not... | null |
rust-lang__rust-clippy__14473 | rust-lang/rust-clippy | 14,473 | defect | f5d81a314a5765be237f716dca2b0ea42f460095 | d2759abfe5e05e1a49278aa012db67403c8c4c26 | fix: `iter_cloned_collect` FP with custom `From`/`IntoIterator` impl | Closes #9119
changelog: [`iter_cloned_collect`]: fix FP with custom `From`/`IntoIterator` impl
| diff --git a/clippy_lints/src/methods/iter_cloned_collect.rs b/clippy_lints/src/methods/iter_cloned_collect.rs
index 49de83885a1c..45d7e6b1be9c 100644
--- a/clippy_lints/src/methods/iter_cloned_collect.rs
+++ b/clippy_lints/src/methods/iter_cloned_collect.rs
@@ -1,16 +1,22 @@
use crate::methods::utils::derefs_to_slice... | 2 | 2 | 1 | [{"id": "G0", "claim": "Since `expr` is known to be a `Vec`, the code can use `args.type_at(0)` instead of binding `vec_item_ty` via `args.types().next()`.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "`iter_item_ty.peel_refs()` may peel too ma... | null |
rust-lang__rust-clippy__14503 | rust-lang/rust-clippy | 14,503 | defect | 193e9f2c69df0ee8eb6ece420bed841521b4a226 | 61ae64ba7dc2a6f823ae0e448a038f0d0ec0a2db | Refactor `useless_vec` lint | Currently there's an "implicit" invariant in this lint's code, which has been bugging me for a while (but especially so because I recently wanted to extend this lint): when we see a `vec![]` expression that we can't suggest changing to an array because of surrounding expressions (e.g. it's passed to a function that req... | diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs
index 3346b15dae9c..d16748a346e3 100644
--- a/clippy_lints/src/vec.rs
+++ b/clippy_lints/src/vec.rs
@@ -1,4 +1,6 @@
use std::collections::BTreeMap;
+use std::collections::btree_map::Entry;
+use std::mem;
use std::ops::ControlFlow;
use clippy_config::Co... | 1 | 1 | 0 | [{"id": "G0", "claim": "Getting the snippet is fallible, so `.unwrap_or_default()` in `SuggestedType::snippet()` silently swallows failures and produces an empty suggestion — either the applicability should be recorded in `VecState` (as it was before) or `.unwrap()` should have been used.", "category": "correctness", "... | null |
rust-lang__rust-clippy__15745 | rust-lang/rust-clippy | 15,745 | defect | af0bc983b5b0a6f3f8d05f8a0baed4e97ec51d39 | d34f4eda58f60df54dc6d40e322f749472afee11 | Add a check for some followed by filter | *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/15745)*
Add a check for some followed by filter.
The program will suggest using the `then_some` method.
changelog: [`filter_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_some
| diff --git a/CHANGELOG.md b/CHANGELOG.md
index c773cf15756b..887b432f9e3e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6135,6 +6135,7 @@ Released 2018-09-13
[`filter_map_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_identity
[`filter_map_next`]: https://rust-lang.github.io/rust-... | 17 | 15 | 2 | [{"id": "G0", "claim": "The lint must check the MSRV before suggesting `bool::then_some()`, which has been available only since Rust 1.62.0.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "The pull request should include tests for the most complicate... | null |
rust-lang__rust-clippy__16025 | rust-lang/rust-clippy | 16,025 | defect | ad7fc4f4684d825ad492f5b0f487fa601f7ac272 | 7ae07b6425dace5461a5006e28dbf4e16d10b5d7 | feat(manual_assert_eq): new lint | *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/16025)*
Resolves https://github.com/rust-lang/rust-clippy/issues/13252
Resurrection of https://github.com/rust-lang/rust-clippy/pull/13333
changelog: [`manual_assert_eq`]: new lint | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6cb2755be0ee..09a223ca6d5e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6526,6 +6526,7 @@ Released 2018-09-13
[`main_recursion`]: https://rust-lang.github.io/rust-clippy/master/index.html#main_recursion
[`manual_abs_diff`]: https://rust-lang.github.io/rust-clippy/mas... | 6 | 6 | 4 | [{"id": "G0", "claim": "The lint should identify the macro via `get_diagnostic_name` and match the `assert_macro`/`debug_assert_macro` diagnostic symbols instead of using `item_name`.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The lint's suggestion t... | null |
rust-lang__rust-clippy__16443 | rust-lang/rust-clippy | 16,443 | defect | 62846d25e68cbbf6a5fe5fd3e62159b5ec7ebddf | 5f63167acdce6275aadbf9989ffca9b201a63f4f | Even more fixes for handling of macros | *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/16443)*
Continuation rust-lang/rust-clippy#16337
Even more fixes for handling macros
changelog: [`manual_rotate`] fix wrongly unmangled macros
changelog: [`map_with_unused_argument_over_ranges`] fix wrongly unmangl... | diff --git a/clippy_lints/src/implicit_saturating_sub.rs b/clippy_lints/src/implicit_saturating_sub.rs
index 516f9e3aa60c..27edf0368968 100644
--- a/clippy_lints/src/implicit_saturating_sub.rs
+++ b/clippy_lints/src/implicit_saturating_sub.rs
@@ -252,10 +252,11 @@ fn check_subtraction(
};
... | 5 | 5 | 1 | [{"id": "G0", "claim": "In several lint implementations the snippets/Suggs are built by recomputing `expr.span.ctxt()` (or passing none) where an already-computed SyntaxContext could be reused -- bind the context once (e.g. in the let-chain just before `extract_count_with_applicability`) and pass it to the snippet help... | null |
rust-lang__rust-clippy__16456 | rust-lang/rust-clippy | 16,456 | defect | dc57e57f747a1a5ce13c7674f56bce5864c9f9e1 | b12c8eb203af418ad8dc84aeaef0b5c69c0bc2b6 | Extend `manual_filter` to cover `and_then` | *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/16456)*
Closes rust-lang/rust-clippy#14440
Implemented as enhancement to `manual_filter`
changelog: [`manual_filter`] enhance to cover `and_then`
| diff --git a/clippy_lints/src/matches/manual_filter.rs b/clippy_lints/src/matches/manual_filter.rs
index da68f8421c16..998ed3e6628f 100644
--- a/clippy_lints/src/matches/manual_filter.rs
+++ b/clippy_lints/src/matches/manual_filter.rs
@@ -1,10 +1,14 @@
+use std::borrow::Cow;
+
use clippy_utils::as_some_expr;
use clip... | 11 | 11 | 2 | [{"id": "G0", "claim": "The snippet formatting in `check_method_call` could be done inside the `span_lint_and_then` closure instead of before the lint call.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "It could be beneficial to lint, and sugge... | null |
rust-lang__rust-clippy__16486 | rust-lang/rust-clippy | 16,486 | defect | 736e4b8c6b9e651b299781bbd2cdfaf639ac74b0 | 0a051c47eb128803ba084f2cac016c085cb7c777 | Add new lint `inline_trait_bounds` | *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/16486)*
This PR adds a new restriction lint, `inline_trait_bounds`, which enforces the use of `where` clauses instead of inline trait bounds. The lint is allow-by-default.
changelog: [`inline_trait_bounds`]: add new li... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 795eba1dfeaf..140345907f91 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6590,6 +6590,7 @@ Released 2018-09-13
[`inline_asm_x86_att_syntax`]: https://rust-lang.github.io/rust-clippy/master/index.html#inline_asm_x86_att_syntax
[`inline_asm_x86_intel_syntax`]: https://r... | 10 | 8 | 2 | [{"id": "G0", "claim": "The `#![allow(unused)]` attribute in tests/ui/inline_trait_bounds.rs is not required in tests and should be removed.", "category": "maintainability", "verdict": "supported", "priority": "P2", "scope": "introduced"}, {"id": "G1", "claim": "The lint should suggest an automatic fix instead of only ... | null |
rust-lang__rust-clippy__16530 | rust-lang/rust-clippy | 16,530 | defect | b303ab4c86361b9e3d7c803237f0b8ef5c7804d7 | f180a192b7ea1d0803c48576bfae82765627442f | Add unnecessary_trailing_comma lint | This matches `cargo fmt` behavior but for `format!(...)` -style macro calls.
To make this PR easier to review, it moves all linting of the clippy code to rust-lang/rust-clippy#16533
Suggest removing an unnecessary trailing comma before the closing parenthesis in single-line format-like macro invocations (e.g. pri... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 795eba1dfeaf..1e8688819a88 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,11 @@ document.
[92b4b68...master](https://github.com/rust-lang/rust-clippy/compare/92b4b68...master)
+### New Lints
+
+* Added [`unnecessary_trailing_comma`] to `style` (single-line fo... | 6 | 6 | 3 | [{"id": "G0", "claim": "The lint misses bracket-delimited invocations: `println![\"hi\",]`, which is allowed Rust, does not trigger the lint.", "category": "correctness", "verdict": "supported", "priority": "P1", "scope": "introduced"}, {"id": "G1", "claim": "For `println![\"Foo(,)\", ]` the lint emits an incorrect cor... | null |
rust-lang__rust-clippy__16617 | rust-lang/rust-clippy | 16,617 | defect | ac86fd103df1434db04ad223e5daa891a8a434ab | f37256d5c8b578d113dd905bad828ad5dc95f052 | New lint: `manual_clear` | This proposes replacing calls to `.truncate(0)` for types in the standard library by `.clear()`, as the specialized version might be more efficient.
changelog: [`manual_clear`]: new lint
Closes rust-lang/rust-clippy#16615 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 45bfb65b2e67..db8134eff8f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6771,6 +6771,7 @@ Released 2018-09-13
[`manual_c_str_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals
[`manual_checked_ops`]: https://rust-lang.github.i... | 1 | 1 | 0 | [{"id": "G0", "claim": "Use a single-suggestion API such as `span_suggestion` instead of `multipart_suggestion`, since the suggestion vector contains only one replacement.", "category": "design", "verdict": "supported", "priority": "P2", "scope": "introduced"}] | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.