-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tuple_array_conversions
lint makes code less readable when slice is involved
#11082
Open
Tracked by
#11151
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Comments
Aaron1011
added
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
labels
Jul 3, 2023
I think it should still lint, it prevents you from updating |
MingweiSamuel
added a commit
to hydro-project/rust-clippy
that referenced
this issue
Jul 12, 2023
The lint suggestion is arguably often less readable and more complex than the original code. For example, which of the following is the most readable: ```rust let _vertices = edges.flat_map(|(src, dst)| [src, dst]); let _vertices = edges.flat_map(<_ as Into<[i32; 2]>>::into); let _vertices = edges.flat_map(<[i32; 2]>::from); ``` The lint really only applies if the tuple is either long enough that naming the fields is silly (maybe at least 4 entries long), or if the author intends the fields to be homogenous, which is author intent and can't be determined by the lint. Therefore I think the lint should be marked as pedantic. Currently, there are also a lot of false positives with the lint: * rust-lang#11082 & https://github.com/rust-lang/rust-clippy/issues/11the tuple is either long enough that naming the fields is silly (maybe at least 4 entries long), or if the author intends the fields to be homogenous, which is author intent and can't be determined by the lint. Therefore I think the lint should be marked as pedantic. Currently, there are also a lot of false positives with the lint: * rust-lang#11082 * rust-lang#11085 * rust-lang#11100 (rust-lang#11105) * rust-lang#11124 * rust-lang#11144 Should fix those issues before enabling it for everyone.
MingweiSamuel
added a commit
to hydro-project/rust-clippy
that referenced
this issue
Jul 12, 2023
The lint suggestion is arguably often less readable and more complex than the original code. For example, which of the following is the most readable: ```rust let _vertices = edges.flat_map(|(src, dst)| [src, dst]); let _vertices = edges.flat_map(<_ as Into<[i32; 2]>>::into); let _vertices = edges.flat_map(<[i32; 2]>::from); ``` The lint really only applies if the tuple is either long enough that naming the fields is silly (maybe at least 4 entries long), or if the author intends the fields to be homogenous, which is author intent and can't be determined by the lint. Therefore I think the lint should be marked as pedantic. Currently, there are also a lot of false positives with the lint: * rust-lang#11082 * rust-lang#11085 * rust-lang#11100 (rust-lang#11105) * rust-lang#11124 * rust-lang#11144 Should fix those issues before enabling it for everyone.
MingweiSamuel
added a commit
to hydro-project/rust-clippy
that referenced
this issue
Jul 12, 2023
Due to outstanding issues: * rust-lang#11082 * rust-lang#11085 * rust-lang#11100 (rust-lang#11105) * rust-lang#11124 * rust-lang#11144
bors
added a commit
that referenced
this issue
Jul 13, 2023
…i3,xFrednet [`tuple_array_conversions`]: move from `complexity` to `nursery` The lint suggestion is arguably often less readable and more complex than the original code. For example, which of the following is the most readable: ```rust let _vertices = edges.flat_map(|(src, dst)| [src, dst]); let _vertices = edges.flat_map(<_ as Into<[i32; 2]>>::into); let _vertices = edges.flat_map(<[i32; 2]>::from); ``` The lint can be useful, but really only applies if the tuple is either long enough that naming the fields is silly (maybe at least 4 entries long), or if the author intends the fields to be homogenous, which is author intent and can't be determined by the lint. Therefore I think the lint should be marked as pedantic. Currently, there are also a lot of false positives with the lint: * #11082 * #11085 * #11100 (#11105) * #11124 * #11144 Should fix those issues before enabling it for everyone. --- changelog: Move [`tuple_array_conversions`] to `nursery` (Now allow-by-default) <!-- FIY: Ignore this change, if the commit gets backported --> [#11146](#11146)
bors
added a commit
that referenced
this issue
Jul 18, 2023
Rewrite [`tuple_array_conversions`] Fixes #11100 Fixes #11144 Fixes #11124 #11082 still needs discussion and #11085 likely can't be fixed. changelog: [`tuple_array_conversions`]: Move to `pedantic` changelog: [`tuple_array_conversions`]: Don't lint if mutability of references changes changelog: [`tuple_array_conversions`]: Don't lint if bindings don't come from the exact same pattern changelog: [`tuple_array_conversions`]: Don't lint if bindings are used for more than just the conversion
ofeeg
pushed a commit
to ofeeg/rust-clippy
that referenced
this issue
Aug 14, 2023
Fixed errors and lack of documentation in mod.rs. Added type check and test case for string slice. Added supposed check for windows paths. Build failure fix. Build fix attempt rust-lang#2. Fixed formatting. Refactor unwind from Option to a new enum Fix tools Make elaborator generic Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup Tweak output for 'add line' suggestion Special-case item attributes in the suggestion output resolve: Pre-compute non-reexport module children Instead of repeating the same logic by walking HIR during metadata encoding. The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises. `module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead. Alloc `hir::Lit` in an arena to remove the destructor from `Expr` This allows allocating `Expr`s into a dropless arena, which is useful for using length prefixed thing slices in HIR, since these can only be allocated in the dropless arena and not in a typed arena. This is something I'm working on. clippy: add test for rust-lang#10645 Remove very useless `as_substs` usage from clippy Force -Zflatten-format-args=no in Clippy. Remove WithOptconstParam. offset_of Evaluate place expression in `PlaceMention`. Allow `LocalDefId` as the argument to `def_path_str` Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup Clippy book: hotfix for broken link change usages of explicit_item_bounds to bound_explicit_item_bounds add EarlyBinder to output of explicit_item_bounds; replace bound_explicit_item_bounds usages; remove bound_explicit_item_bounds query add subst_identity_iter and subst_identity_iter_copied methods on EarlyBinder; use this to simplify some EarlyBinder noise around explicit_item_bounds calls rename `needs_infer` to `has_infer` Make clippy happy uplift `clippy::clone_double_ref` as `suspicious_double_ref_op` clean up Colon from clippy Restrict `From<S>` for `{D,Subd}iagnosticMessage`. Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile. Use `ty::TraitRef::new` in clippy Fix uses of `TraitRef::identity` in clippy and rustdoc Rename std::mem::size_of_value to std::mem::size_of_val Suggest applicable expression for manual slice size calculation lint Add run-rustfix marker and test file Use `clippy_utils::std_or_core` in manual slice size calculation lint Ignore `manual_slice_size_calculation` in code from macro expansions Add size-parameter to unecessary_box_returns Fixes rust-lang#10641 Suppress the triggering of some lints in derived structures Address comments Update version attribute for 1.69 lints Changelog for Rust 1.69 🌸 [arithmetic_side_effects] Fix rust-lang#10590 Update to a compiletest-rs version that requires `//@` for commands [arithmetic_side_effects] Cache symbols Fix typo in significant_drop_tightening Fix `#[allow(clippy::enum_variant_names)]` directly on variants make [`len_zero`] lint not spanning over parenthesis clippy: drop unused semver crate Ignore `impl Trait`(s) Add lint `items_after_test_module` Compact emmited lint Bump Clippy version -> 0.1.71 Bump nightly version -> 2023-04-23 Fix dogfood test Dont suggest suboptimal_flops unavailable in nostd Fixes rust-lang#10634 use is_inside_const_context query for in_constant split test into 2 Remove check for `lib.register_*` and `src/docs*` in `cargo dev update_lints` This reverts commit 22d435b. Detect if expressions with boolean assignments to the same target Spelling * applying * binding * complex * constituent * demonstrate * desugaring * exact * expression * for * functionalities * github * implementation * infers * multiple conflicting traits * mutable * necessarily * nightly * nonexistent * optional * parameter * reassignments * resources * substitution * suggestion * that * that array is * using the Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Rewrite search_same description Ignore `shadow` warns in code from macro expansions fix false positive Update allow_attributes_false_positive.rs also check for rest pat in `redundant_pattern_matching` Improve the help message + add a help span don't check if from macro invocation run cargo dev fmt make cargo test pass use in_external_macro Catching, stray, commas, (I'll, never, learn, to, use, them, correctly) 😅 Add the warning to all documentation. add `semicolon_outside_block_if_singleline` lint make cargo test pass refactor make cargo test pass, again improve description a bit refactor config instead of new lint and don't panic make cargo test pass change names to not be implicitly negative use `//@` for commands in tests Update lint_configuration.md run linkcheck in Remark CI fix new lints link install nightly rust-docs run linkcheck without nightly toolchain remove nightly toolchain, add rust-docs component Test Remark Update basics.md Update basics.md Update basics.md update workflow add rust docs toolchain Update remark.yml workflow test manual test update book path add linkcheck book to CI Update lint_passes.md Fix rust-lang#10713 and move the tests to a subdir Remove useless span magic Change module import system Rename items + Delete `imported_module.stderr` new lint: `while_pop_unwrap` elide lifetimes, get rid of glob import move lint to loops, emit proper suggestion, more tests remove unnecessary reference make PopStmt copy+clone rename lint to `manual_while_let_some` fix run-rustfix directive Clarify docs for RESULT_LARGE_ERR globally ignore `#[no_std]` crates Don't ignore `check_radians` Update macros.rs adds lint to detect construction of unit struct using `default` Using `default` to construct a unit struct increases code complexity and adds a function call. This can be avoided by simply removing the call to `default` and simply construct by name. fix diagnostic message style Co-authored-by: Ruby Lazuli <general@patchmixolydic.com> fixed span and corrected test output rename to plural form add more test cases fix failing tests add `rustfix` annotation fix lint docs Inherit stdout/stderr for `cargo dev dogfood` Bump nightly version -> 2023-05-05 Ignore expressions from macros in default_constructed_unit_structs new lint: clippy::ref_patterns Add missing word "are" Ignore `borrow_deref_ref` warnings in code from procedural macros. `Wildcard_imports` ignore `test.rs` files Really mini minor irrelevant change for formatting Now the lint ignores any crates with `--cfg test` Fix header Bump README copyright wip WIP WIP WIP Working Update trait_bounds.rs Update trait_bounds.rs Comments Comments Minimizing changes Fix config formatting, less indenting, more spacing needless_bool: do not simplify code if it loses comments add lint `manual_next_back` checks for manual reverse iteration (`.rev().next()`) of a `DoubleEndedIterator` Update actions/checkout Update actions/setup-node fix: warn on empty line outer AttrKind::DocComment changelog: [`empty_line_after_doc_comments`]: add lint for checking empty lines after rustdoc comments. Fixes: rust-lang#10395 Consider referenced allowed or hard-coded types fix rust-lang#10773 move `is_ty_alias` to `clippy_utils` flip1995: Stepping down from the reviewer rotation A step I was trying to avoid for way too long, but sadly necessary now. I hope I can come back stronger in a few months. Rebase and merge attempt number 2. Included sources to std::path in lint string. Rebase and merge attempt number 2. Fixed arguments in lint string. Renamed lint to join_absolute_path as per request. Ran cargo dev update_lints Ran cargo dev bless after a full cargo test Entered supposed changes, ran cargo dev fmt, test, and bless. initial step towards implementing C string literals rm diag item, use lang item Merge commit '371120bdbf58a331db5dcfb2d9cddc040f486de8' into clippyup Make the BUG_REPORT_URL configurable by tools This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy the entire hook implementation. - Switch clippy to the new hook This also adds a `extra_info` callback so clippy can include its own version number, which differs from rustc's. - Call `install_ice_hook` in rustfmt make (try_)subst_and_normalize_erasing_regions take EarlyBinder changes from review: add FIXME to clippy and change subst_identity to skip_binder in mir subst methods IAT: Introduce AliasKind::Inherent Drop uplifted clippy::drop_ref Drop uplifted clippy::drop_copy Drop uplifted clippy::forget_ref Drop uplifted clippy::forget_copy Exposes false negative in clippy's diverging_sub_expression Remove `LangItems::require` It's just a short wrapper used by `tcx.require_lang_item`. Deleting it gives us a negative diff. Exclude inherent projections from some alias ty matches Merge commit '435a8ad86c7a33bd7ffb91c59039943408d3b6aa' into clippyup Rename `drop_copy` lint to `dropping_copy_types` Rename `forget_copy` lint to `forgetting_copy_types` Rename `drop_ref` lint to `dropping_references` Rename `forget_ref` lint to `forgetting_references` Replace EarlyBinder(x) with EarlyBinder::new(x) Make EarlyBinder's inner value private; and fix all of the resulting errors Use `Cow` in `{D,Subd}iagnosticMessage`. Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment: ``` // FIXME(davidtwco): can a `Cow<'static, str>` be used here? ``` This commit answers that question in the affirmative. It's not the most compelling change ever, but it might be worth merging. This requires changing the `impl<'a> From<&'a str>` impls to `impl From<&'static str>`, which involves a bunch of knock-on changes that require/result in call sites being a little more precise about exactly what kind of string they use to create errors, and not just `&str`. This will result in fewer unnecessary allocations, though this will not have any notable perf effects given that these are error paths. Note that I was lazy within Clippy, using `to_string` in a few places to preserve the existing string imprecision. I could have used `impl Into<{D,Subd}iagnosticMessage>` in various places as is done in the compiler, but that would have required changes to *many* call sites (mostly changing `&format("...")` to `format!("...")`) which didn't seem worthwhile. Drop uplifted clippy::invalid_utf8_in_unchecked EarlyBinder::new -> EarlyBinder::bind Drop uplifted clippy::cast_ref_to_mut Use translatable diagnostics in `rustc_const_eval` Implement custom diagnostic for ConstParamTy Merge commit '30448e8cf98d4754350db0c959644564f317bc0f' into clippyup Rename `impl_defaultness` to `defaultness` Removed stable/unstable sort arg from into_sorted_stable_ord, fixed a few misc issues, added collect to UnordItems Whoops, submodule change was actually valid - undoing fixup Drop uplifted clippy::undropped_manually_drops Drop uplifted `clippy:cmp_nan` Extend `unused_must_use` to cover block exprs Add `AliasKind::Weak` for type aliases. Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases. Move WF goal to clause Move ConstEvaluatable to Clause Treat TAIT equation as always ambiguous in coherence Better error for non const `PartialEq` call generated by `match` Make `{Arc,Rc,Weak}::ptr_eq` ignore pointer metadata s/Clause/ClauseKind Support `ast::ExprKind::Become` in clippy Migrate item_bounds to ty::Clause Do not offer any of the suggestions in emit_coerce_suggestions for expr from destructuring assignment desugaring Support `hir::ExprKind::Become` in clippy Migrate predicates_of and caller_bounds to Clause Provide more context for `rustc +nightly -Zunstable-options` on stable Make simd_shuffle_indices use valtrees Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyup Fix valtree changes Fix compile-test tests to work with the new ui_test crate Deal with fallout Patch clippy Move `TyCtxt::mk_x` to `Ty::new_x` where applicable Fix failing clippy tests Comments out the C string literals due to rust-lang/rust#113334 Fixes rust-lang#11121 Rename `adjustment::PointerCast` and variants using it to `PointerCoercion` It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum. Delete `to_string_in_format_args_incremental.rs` It fails CI and passes locally. It passes random directores in `-Cincremental` so maybe something's up. It shouldn't block us here. Drop uplifted `clippy::fn_null_check` Ignore flaky clippy tests. Suggest the correct variable name for `manual_let_else` Split if conditions by its semantics Remove old feature flag in code comment Since let_else feature has been stable in 1.65.0, it's now unnecessary Avoid renaming for TupleStruct with multiple arguments update spec fix: move specs in fire Fix: Some suggestions generated by the option_if_let_else lint did not compile bump up `regex-syntax` dependency version to 0.7.0 Ignoring `let_underscore_untyped` warnings in code from proc macros fixing fmt Checking for proc_macro not only when local.init is Some Remove unnecessary from example fix example heading in `string_slice` don't remove `dbg!` in arbitrary expressions handle nested macros and add tests for them Rename integer_arithmetic redundant_pattern_matching redundant_pattern_matching fix conflict with matches macro fix conflict with matches macro fix error test update a func fix reviewer comments fix reviewer comments: tests results update tests update test option Don't suggest unnameable types in box_default, let_underscore_untyped Search for inactive `cfg` attributes and empty macro expansion through the entire block Slightly refactor constant evaluation and add detection for empty macro expansion and `cfg`ed statements. Improve `SpanlessEq` * Don't consider expansions of different macros to be the same, even if they expand to the same tokens * Don't consider `cfg!` expansions to be equal if they check different configs. enhance `needless_collect` Updates `needless_collect` to lint for collecting into a method or function argument thats taking an `IntoIterator` (for example `extend`). Every `Iterator` trivially implements `IntoIterator` and colleting it only causes an unnecessary allocation. Add new `UNIQUE_CFG_CONDITION` lint Add UI test for UNIQUE_CFG_CONDITION Update CHANGELOG Add check for empty cfg `all` condition Update urls in Type Checking Bump nightly version -> 2023-05-20 [`match_wild_err_arm`]: do not lint in const contexts consider array initializer for `large_stack_arrays` add test case for rust-lang#10741 Unit tests highlighting unsafe match issue These unit tests generate non-compilable code. I did NOT `bless` them on purpose because the stderr output is not good. I'm surprised we don't auto-compile the suggestions here - is this something that can be easily enabled? See rust-lang#10808 Fix unsafe blocks Use #[rustfmt::skip] remove todo Run-rustfix needless_else: new lint to check for empty else clauses the implementation!! check msrv Update clippy_lints/src/casts/ptr_cast_constness.rs Co-authored-by: llogiq <bogusandre@gmail.com> add description and rename msrv tests change `clippy::version` to 1.71.0 Display the `needless_return` suggestion error out if lint name contains dash replace `-` instead of erroring out apply suggestion Co-authored-by: Philipp Krones <hello@philkrones.com> Address Dependabot alerts do not consider `await` in nested `async` blocks remove old span_lint point to `await` expr in note redundant pattern matches! result [`default_constructed_unit_structs`]: do not lint type aliases Ignore #[cfg]'d out code in needless_else Fix formatting of if let chain Some improvements to the manual_let_else lint suggestions * Replace variables inside | patterns in the if let: let v = if let V::A(v) | V::B(v) = v { v } else ... * Support nested patterns: let v = if let Ok(Ok(Ok(v))) = v { v } else ... * Support tuple structs with more than one arg: let v = V::W(v, _) = v { v } else ... * Correctly handle .. in tuple struct patterns: let v = V::X(v, ..) = v { v } else ... Fixing `invalid_regex` with invalid UTF8. Also, adding more test cases Update version attribute for 1.70 lints Changelog for Rust 1.70 🔨 Change changelog typos Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com> deps: drop serde feature from url actually, remove rustc-workspace-hack dependency too [`wildcard_imports`] Modules that contain `prelude` are also allowed This commit fixes rust-lang#10846 by checking if the path segment contains the word "prelude". Signed-off-by: Charalampos Mitrodimas <charmitro@gmail.com> fix issues 10836 change booleans file and update tests Remove lint name and category fields from the new lint issue form new lint: `missing_field_in_debug` move some strings into consts, more tests s/missing_field_in_debug/missing_fields_in_debug dont trigger in macro expansions make dogfood tests happy minor cleanups replace HashSet with FxHashSet replace match_def_path with match_type if_chain -> let chains, fix markdown, allow newtype pattern fmt consider string literal in `.field()` calls as used don't intern defined symbol, remove mentions of 'debug_tuple' special-case PD, account for field access through `Deref` don't lint enums, update note in lint description Explain which paths clippy searches for configuration in docs Explain path-search using a list Add spans to `clippy.toml` error messages Bump nightly version -> 2023-06-02 Bump Clippy version -> 0.1.72 add checking for cfg(features = ...) Update *Current stable* text in `CHANGELOG.md` Refresh Lint Configuration's looks emit `unnecessary_cast` on raw pointers as well ok actually appease CI I should always run cargo test before committing 😅 add generics in test also ensure generics with the same type are linted Use URL parameters for filter states This retains the settings during browser navigation and allows sharing links with additional configuration. Handle back/forward when using URL parameters for filter states Clippy Lints page - Delay updating of the URL in response to search input Update on blur, enter keypress, and a debounced delay of 1000 ms. This keeps the URL updated, but not distractingly so. Clippy Lints page - Do not show groups in URL parameters if reset to defaults Clippy Lints page - Fix path watch triggering Clippy Lints page - Do not show filters in URL if configured as default values only lint when `cast_from` and `cast_to`'s ty are the same weird manual_let_else: only add () around PatKind::Or at the top level At the top level, () are required, but on the levels below they are not. Support multi-binding situations as well as tuple patterns Support struct patterns new lint: `explicit_into_iter_fn_arg` dogfood update docs, simplify arg->param map, dont lint on chain merge `explicit_into_iter_fn_arg` into `useless_conversion` fix new failing proc macro tests add plural form to useless_conversion if depth > 0 Add lint to check lint formulation messages Fix lints that don't conform to the standard formulation refactor(test): Move attribute to lint level Fix suggestion on fully qualified syntax ignore `Foo::deref` altogether Add from_over_into replace for type in `Self` reference Ignore from_over_into if it contains Self Move bail into lint to prevent no-linting, move to unfixable don't lint `allow_attributes` on attributes from proc macros foiled again (forgot to run cargo test) Fix `attr_search_pat` for `#[cfg_attr]` remove tuple add test for `?` desugaring Update allow_attributes_without_reason.rs `to_xx_bytes` implemented, `from_xx_bytes` todo Mentioned in rust-lang#10765 implement `host_endian_bytes` and the other two weird grammar refine output unidiomatic `if_chain!` don't allocate the names use enum for `prefix` instead of `&str` Update endian_bytes.rs derive Copy/PartialEq for `Prefix` Remove `CARGO_UNSTABLE_SPARSE_REGISTRY` env from ci It is now the default to use the sparse registry Move redundant_clone to nursery Add a test that checks for old style test headers [`unnecessary_lazy_eval`]: don't lint on types with deref impl Bring up Rust lang #37612 as a known problem for let_and_return Compact issue link Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com> Add redundant type annotations lint Move `redundant_type_annotations` to restriction Extract common logic to function Add support to returned refs from `MethodCall` Add `Limitations` section make cast_possible_wrap not lint on conversions for sizes that cannot wrap, and make it work correctly for 16 bit {u,i}size add more info link Fix rust-lang#10498 Use type snippet instead of init expr for proc macro check check for `_` instead account for autoderef in eager_or_lazy don't call `type_of` on generic params Don't warn if there is a comment between else and curly bracket make `useless_vec` smarter allow the lint in a bunch of tests don't allow `as_slice` for now Adds new lint `arc_with_non_send_or_sync` Updating documentation and lint formatting. Adding extra check to ignore generic args. Swapping to matches macro. handle RangeInclusive function desugar actually don't lint for inclusive range Fix `useless_vec` suggestion in `for _ in vec![..]` Ignore more pointer types in `unnecessary_cast` check that the adjusted receiver type matches target add the `excessive_*` style lints change it to nursery category add `excessive_nesting` Close code block in example couple more notes decided against reinventing the wheel check non-inline modules, ignore all macros work with lint attributes move to `complexity` but don't lint by default Check if from proc macro and better tests remove revisions fix rust-lang#10776 actually fix it also lint single expression blocks Update mixed_read_write_in_expression.rs Update diverging_sub_expression.stderr ensure there are no stmts for expr check refactor Update excessive_nesting.rs Update excessive_nesting.rs allow disabling module inception on private modules allow disabling module inception on private modules Direct towards late passes in `cargo dev new_lint` handle exponent without digits add test ignore more type aliases in unnecessary_cast ignore more type aliases in unnecessary_cast Update unnecessary_cast.stderr Add `needless_if` lint make cargo test pass add description add description don't lint on `if let` don't lint on `if let` Update needless_if.fixed Stop visiting once it's found `Let` Extend `explicit_iter_loop` to all types Split `for_loops` tests Fix `explicit_into_iter_loop` with mutable references Reborrow mutable references in `explicit_iter_loop` Fix rust-lang#10504, don't lint on derived code refactor Update trait_bounds.rs `ty_search_pat` `impl WithSearchPat for Ty` Update check_proc_macro.rs Add lint `single_letter_idents` rename the lint make cargo test pass + example ignore generics and allow arbitrary threshold make it work for locals as well oopos add to tests and configuration `cargo collect-metadata` refactor and add link to issue new lint: `large_stack_frames` `cargo dev update_lints` fmt use span_lint_and_note rename "drawbacks" to "known issues" make lint description easier to read, prevent ICE fix rebase weirdness update lint_configuration.md Don't ling `as_conversions` in proc macros [`useless_vec`]: detect unnecessary `vec![_]` add- and fix existing tests Add test code Boilerplate for the new lint Add hook Add the lint to the lib Implement the lint Implement the lint for expect Implement the suggestion Recognize `Ok` Recognize `unwrap_or` methods Recognize `unwrap_or_else` method Track init and unwrap of expr Recognize `Err` Support suggesting panics Add more tests Preserve type annotations when present Fix all the other tests Don't lint non-statement/faux empty `needless_if`s Now `cargo collect-metadata` updates the `CHANGELOG.md` Remove dead code in `needless_pass_by_value` Fix `missing_const_for_fn` not checking `~const Destruct` use trait solver instead; created spaghetti code cleanup spaghetti code remove unnecessary checks remove `in_move` [`needless_lifetimes`]' suggestion now points at the lifetimes [`no_effect`]: suggest adding `return` if applicable make cargo test pass Revert "Make it `Unspecified`" This reverts commit 7748630. Make it `Unspecified` [`map_unwrap_or`]: don't lint when referenced variable is moved Ignore `main()` in `no_test` code fences run `cargo dev fmt` add main function to test itself [`derivable_impls`]: don't lint if expr unsize-coerces fmt dogfood fix internal lints Add lint [`single_range_in_vec_init`] refactor a bit [`unnecessary_fold`]: suggest turbofish if necessary get rid of unnecessary function pointer move check_fold_with_op function out from_over_into: Show suggestions for non-Self expanded paths [`match_same_arms`]: don't lint if `non_exhaustive_omitted_patterns` formatting :/ new lint: `drain_collect` take into account reborrowing when inserting `&mut` in sugg make clippy happy add a description add test case for not whole length, move sugg into variable add lint [`needless_clone_impl`] Update needless_impls.rs rename lint and disallow `clone_from` missing_panics_doc: pickup expect method bless address or allow clippy::missing_panics_doc in clippy-dev merge test improve grammer in comment sentence Co-authored-by: dswij <dharmasw@outlook.com> Refactor to make following commit pass single_match_else lint Make `--explain` subcommand return 1 for missing lints Ignore more type aliases in `unnecessary_cast` Adapt versions.html file to cleaned up gh-pages Fix version.py after deleting v* dirs I missed updating this file. I also ran black and isort over it. Adding configuration to allow safety comment above stmt containing unsafe block Addressing reviewer comments adding all ui tests to the configuration test as well Collecting metadata Exlude `todo!()` from `missing_panics_in_doc` `missing_panics_in_doc` bless test and add additional macro testcase new lint `single_call_fn` add test for closures Ignore functions annotated with `#[test]` Fix `find_format_arg_expr` when incremental compilation is enabled Fix rust-lang#10792 Dogfood Fix false positive of [self_named_module_files] and [mod_module_files] Move continue into if statement Co-authored-by: Catherine <114838443+Centri3@users.noreply.github.com> [`redundant_closure_call`]: handle nested closures fix docs don't unnecessarily walk more in visitor and add more tests Ignore in-proc-macros items use PlaceRef abstractions add non-test-case for suggesting const on functions accessing union fields allow safety comment above attributes [`single_match`]: don't lint if block contains comments add test for block comment and add note to description Don't lint `excessive_precision` on inf Add WebAssembly to allowed idents add WebAssembly to test [`borrow_as_ptr`]: Ignore temporaries use rustc's criteria for a temporary Don't lint `iter_nth_zero` in `next` include a ref if argument is not just a numeric literal use let chains, move assignments out of block, add tests declare needs_ref later [`type_repetition_in_bounds`]: respect msrv for combining maybe bounds put issue link between <> rename MSRV alias, add MSRV to lint doc update lint configuration Don't lint `ptr_arg` when return type uses Cow's lifetime [`format_push_string`]: look through match, if, if-let Avoid linting on procedural macros Lint `mem_forget` if fields are `Drop` move to `drop_forget_ref` make note less verbose Check if `if` conditions always evaluate to true in `never_loop` update changelog's data ranges Port clippy away from compiletest to ui_test Update tests Find the right `cargo-clippy` binary in CI Don't lint code from external macros add `needless_raw_string_hashes` lint add semicolon in doctest new lint `needless_raw_string` + refactor a bit Thanks, #112373, for the snippet at line 75! Update raw_strings.rs don't lint `needless_raw_string_hashes` when it's unnecessary change category and refactor Update raw_strings.rs Revert "new lints for visibility" This reverts commit 0e5a537. new lints for visibility Fix compile-test under cargo nextest Add BLESS for compile-test and some cleanup new lint: `manual_range_pattern` manual_range_pattern -> manual_range_patterns Use substring matching for TESTNAME new lints for visibility Change category and update to `ui_test` [`unused_async`]: don't lint on async trait impls move `is_in_trait_method` to utils and rename [`option_if_let_else`]: suggest `.as_ref()` if `&Option<_>` allow dead code in the test [`question_mark`]: don't lint inside of `try` block lint in nested bodies if `try` is in outer body suggests `is_some_and` over `map().unwrap_or(false)` changed the msrv to 1.70 to suggest `is_some_and` if the msrv is not >= 1.70 then the `map_or` is suggested instead of `is_some_and` (even when `unwrap_or` returns false) now passes dogfood by wrapping unwrap_recv and unwrap_arg into a tuple was previously failing due to `check` having to many arguments. Revert "now passes dogfood by wrapping unwrap_recv and unwrap_arg into a tuple" This reverts commit 7b91844. ignore too_many_arguments on `check` changed msrv name for consistency & changed nested if for style updated list of lints that use msrv ran `cargo collect-metadata` New lint [`redundant_rest_pattern`] Rename the lint Add note to remove `if` statement altogether Fix rust-lang#10413 Dogfood Bump nightly version -> 2023-06-29 Make `eq_op` suggest `.is_nan()` New lint `tuple_array_conversions` Add msrv check and make test pass Fix FP heavily refactor New lint `manual_try_fold` Add msrv tests Typo update docs address comments Fix typos Use `cargo build --tests` in CI let_and_return: lint 'static lifetimes, don't lint borrows in closures Add `SPEEDTEST` Fix dogfood Finally fix dogfood [`missing_fields_in_debug`]: make sure `self` is an adt new lint: `type_id_on_box` that was definitely not the right version add it to the methods lint pass add a few more test cases s/is_dyn_trait/is_dyn_any [`arc_with_non_send_sync`]: look for nested type parameters [`useless_vec`]: use the source span Don't lint manual_let_else in cases where the question mark operator would work Also, lint question_mark for `let...else` clauses that can be simplified to use `?`. This lint isn't perfect as it doesn't support the unstable try blocks. Fix the now stricter lint in manual_rem_euclid.rs Put into one pass Don't suppress manual_let_else if question_mark is allowed If question_mark is allowed, there is no overlap any more, so we can just not suppress it. Move pat_and_expr_can_be_question_mark into clippy_utils Fix FP [`needless_raw_string_hashes`] [`useless_vec`]: add more tests for macro combinations new lint: `read_line_without_trim` add test cases for u32, f32, bool, String Fix regex lints for regex 1.9.0 arc_with_non_send_sync: reword and move to suspicious Pass correct substs to `implements_trait` in `incorrect_impls` `Copy<T>` does in fact not exist. The substs on the trait_ref contain the `Self` type of the impl as the first parameter, so passing that to `implements_trait`, which then nicely prepends the `Self` type for us does not end will. Fix changelog PR listings, create them automatically in `fetch_prs_between.sh` implement `manual_partial_ord_impl` first try at this rename to `manual_partial_ord_and_ord_impl` cargo dev fmt cargo test passes cargo test passes refactor a lil Update bool_comparison.stderr heavily refactor + bump `clippy::version` refactor refactor check bounds to increase accuracy, and add todos use `other` instead of `self` refactor `manual_float_methods` Make suggestion give multiple alternatives Refactor, remove `Constant::to_bits` [significant_drop_tightening] Fix rust-lang#11128 Dogfood Add test for rust-lang#10535 Fix rust-lang#10535 Add needless_pass_by_ref lint Add UI test for `needless_pass_by_ref_mut` Update UI tests with new `needless_pass_by_ref_mut` lint Fix warnings of `needless_pass_by_ref_mut` in clippy Add warning for `NEEDLESS_PASS_BY_REF_MUT` lint about the fact that it changes API Add warning about semver compatibility if it's a public function "try this" -> "try" [`unnecessary_literal_unwrap`]: don't lint if binding initializer is expn [`manual_range_patterns`]: lint negative values [`manual_range_patterns`]: document what range we don't lint changelog: Fix typo in `needless_pass_by_ref_mut` lint description adjust applicability and suggest making binding mutable Use depinfo to discover UI test dependencies [`unnecessary_literal_unwrap`]: lint `unwrap_unchecked` [`unnecessary_literal_unwrap`]: also handle unwrap_err_unchecked Update version attribute for 1.71 lints Changelog for Rust 1.71 👑 Changelog: Add disclaimer about the new format [`panic_in_result_fn`] remove `todo!`, `unimplemented!`, `unreachable!` This commit fixes rust-lang#11025 by removing checks for `todo!`, `unimplemented!` and `unreachable!`. Signed-off-by: Panagiotis Foliadis <pfoliadis@hotmail.com> Add "Known problems" section to `needless_borrow` documentation [`tuple_array_conversions`]: move from `complexity` to `nursery` Due to outstanding issues: * rust-lang#11082 * rust-lang#11085 * rust-lang#11100 (rust-lang#11105) * rust-lang#11124 * rust-lang#11144 [`arithmetic_side_effect`]: allow different rhs type Add `imports_granularity = "Module"` to rustfmt.toml Trigger a rebuild when CLIPPY_CONF_DIR changes Set `unnecessary_cast` suggestion to `MaybeIncorrect` for pointer casts Removing casts may cause type inference to stop working which requires manual intervention Bump Clippy version -> 0.1.73 Bump nightly version -> 2023-07-14 renamed lint Removed if chain. Added the rest of the suggested changes. Applied cargo test supposed changes. Resolved rest of changes. Resolved nitpicks. Update clippy_lints/src/methods/join_absolute_paths.rs Co-authored-by: Catherine Flores <catherine.3.flores@gmail.com> Formatted and blessed. Got rid of println! calls. Rebase attempt number 2
ofeeg
added a commit
to ofeeg/rust-clippy
that referenced
this issue
Aug 15, 2023
Refactor unwind from Option to a new enum Fix tools Make elaborator generic Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup Tweak output for 'add line' suggestion Special-case item attributes in the suggestion output resolve: Pre-compute non-reexport module children Instead of repeating the same logic by walking HIR during metadata encoding. The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises. `module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead. Alloc `hir::Lit` in an arena to remove the destructor from `Expr` This allows allocating `Expr`s into a dropless arena, which is useful for using length prefixed thing slices in HIR, since these can only be allocated in the dropless arena and not in a typed arena. This is something I'm working on. clippy: add test for rust-lang#10645 Remove very useless `as_substs` usage from clippy Force -Zflatten-format-args=no in Clippy. Remove WithOptconstParam. offset_of Evaluate place expression in `PlaceMention`. Allow `LocalDefId` as the argument to `def_path_str` Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup Clippy book: hotfix for broken link change usages of explicit_item_bounds to bound_explicit_item_bounds add EarlyBinder to output of explicit_item_bounds; replace bound_explicit_item_bounds usages; remove bound_explicit_item_bounds query add subst_identity_iter and subst_identity_iter_copied methods on EarlyBinder; use this to simplify some EarlyBinder noise around explicit_item_bounds calls rename `needs_infer` to `has_infer` Make clippy happy uplift `clippy::clone_double_ref` as `suspicious_double_ref_op` clean up Colon from clippy Restrict `From<S>` for `{D,Subd}iagnosticMessage`. Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile. Use `ty::TraitRef::new` in clippy Fix uses of `TraitRef::identity` in clippy and rustdoc Rename std::mem::size_of_value to std::mem::size_of_val Suggest applicable expression for manual slice size calculation lint Add run-rustfix marker and test file Use `clippy_utils::std_or_core` in manual slice size calculation lint Ignore `manual_slice_size_calculation` in code from macro expansions Add size-parameter to unecessary_box_returns Fixes rust-lang#10641 Suppress the triggering of some lints in derived structures Address comments Update version attribute for 1.69 lints Changelog for Rust 1.69 🌸 [arithmetic_side_effects] Fix rust-lang#10590 Update to a compiletest-rs version that requires `//@` for commands [arithmetic_side_effects] Cache symbols Fix typo in significant_drop_tightening Fix `#[allow(clippy::enum_variant_names)]` directly on variants make [`len_zero`] lint not spanning over parenthesis clippy: drop unused semver crate Ignore `impl Trait`(s) Add lint `items_after_test_module` Compact emmited lint Bump Clippy version -> 0.1.71 Bump nightly version -> 2023-04-23 Fix dogfood test Dont suggest suboptimal_flops unavailable in nostd Fixes rust-lang#10634 use is_inside_const_context query for in_constant split test into 2 Remove check for `lib.register_*` and `src/docs*` in `cargo dev update_lints` This reverts commit 22d435b. Detect if expressions with boolean assignments to the same target Spelling * applying * binding * complex * constituent * demonstrate * desugaring * exact * expression * for * functionalities * github * implementation * infers * multiple conflicting traits * mutable * necessarily * nightly * nonexistent * optional * parameter * reassignments * resources * substitution * suggestion * that * that array is * using the Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Rewrite search_same description Ignore `shadow` warns in code from macro expansions fix false positive Update allow_attributes_false_positive.rs also check for rest pat in `redundant_pattern_matching` Improve the help message + add a help span don't check if from macro invocation run cargo dev fmt make cargo test pass use in_external_macro Catching, stray, commas, (I'll, never, learn, to, use, them, correctly) 😅 Add the warning to all documentation. add `semicolon_outside_block_if_singleline` lint make cargo test pass refactor make cargo test pass, again improve description a bit refactor config instead of new lint and don't panic make cargo test pass change names to not be implicitly negative use `//@` for commands in tests Update lint_configuration.md run linkcheck in Remark CI fix new lints link install nightly rust-docs run linkcheck without nightly toolchain remove nightly toolchain, add rust-docs component Test Remark Update basics.md Update basics.md Update basics.md update workflow add rust docs toolchain Update remark.yml workflow test manual test update book path add linkcheck book to CI Update lint_passes.md Fix rust-lang#10713 and move the tests to a subdir Remove useless span magic Change module import system Rename items + Delete `imported_module.stderr` new lint: `while_pop_unwrap` elide lifetimes, get rid of glob import move lint to loops, emit proper suggestion, more tests remove unnecessary reference make PopStmt copy+clone rename lint to `manual_while_let_some` fix run-rustfix directive Clarify docs for RESULT_LARGE_ERR globally ignore `#[no_std]` crates Don't ignore `check_radians` Update macros.rs adds lint to detect construction of unit struct using `default` Using `default` to construct a unit struct increases code complexity and adds a function call. This can be avoided by simply removing the call to `default` and simply construct by name. fix diagnostic message style Co-authored-by: Ruby Lazuli <general@patchmixolydic.com> fixed span and corrected test output rename to plural form add more test cases fix failing tests add `rustfix` annotation fix lint docs Inherit stdout/stderr for `cargo dev dogfood` Bump nightly version -> 2023-05-05 Ignore expressions from macros in default_constructed_unit_structs new lint: clippy::ref_patterns Add missing word "are" Ignore `borrow_deref_ref` warnings in code from procedural macros. `Wildcard_imports` ignore `test.rs` files Really mini minor irrelevant change for formatting Now the lint ignores any crates with `--cfg test` Fix header Bump README copyright wip WIP WIP WIP Working Update trait_bounds.rs Update trait_bounds.rs Comments Comments Minimizing changes Fix config formatting, less indenting, more spacing needless_bool: do not simplify code if it loses comments add lint `manual_next_back` checks for manual reverse iteration (`.rev().next()`) of a `DoubleEndedIterator` Update actions/checkout Update actions/setup-node fix: warn on empty line outer AttrKind::DocComment changelog: [`empty_line_after_doc_comments`]: add lint for checking empty lines after rustdoc comments. Fixes: rust-lang#10395 Consider referenced allowed or hard-coded types fix rust-lang#10773 move `is_ty_alias` to `clippy_utils` flip1995: Stepping down from the reviewer rotation A step I was trying to avoid for way too long, but sadly necessary now. I hope I can come back stronger in a few months. Refactor unwind from Option to a new enum Fix tools Make elaborator generic Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup Tweak output for 'add line' suggestion Special-case item attributes in the suggestion output resolve: Pre-compute non-reexport module children Instead of repeating the same logic by walking HIR during metadata encoding. The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises. `module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead. Alloc `hir::Lit` in an arena to remove the destructor from `Expr` This allows allocating `Expr`s into a dropless arena, which is useful for using length prefixed thing slices in HIR, since these can only be allocated in the dropless arena and not in a typed arena. This is something I'm working on. clippy: add test for rust-lang#10645 Remove very useless `as_substs` usage from clippy Force -Zflatten-format-args=no in Clippy. Remove WithOptconstParam. offset_of Evaluate place expression in `PlaceMention`. Allow `LocalDefId` as the argument to `def_path_str` Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup Clippy book: hotfix for broken link change usages of explicit_item_bounds to bound_explicit_item_bounds add EarlyBinder to output of explicit_item_bounds; replace bound_explicit_item_bounds usages; remove bound_explicit_item_bounds query add subst_identity_iter and subst_identity_iter_copied methods on EarlyBinder; use this to simplify some EarlyBinder noise around explicit_item_bounds calls rename `needs_infer` to `has_infer` Make clippy happy uplift `clippy::clone_double_ref` as `suspicious_double_ref_op` clean up Colon from clippy Restrict `From<S>` for `{D,Subd}iagnosticMessage`. Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile. Use `ty::TraitRef::new` in clippy Fix uses of `TraitRef::identity` in clippy and rustdoc Rename std::mem::size_of_value to std::mem::size_of_val Suggest applicable expression for manual slice size calculation lint Add run-rustfix marker and test file Use `clippy_utils::std_or_core` in manual slice size calculation lint Ignore `manual_slice_size_calculation` in code from macro expansions Add size-parameter to unecessary_box_returns Fixes rust-lang#10641 Suppress the triggering of some lints in derived structures Address comments Update version attribute for 1.69 lints Changelog for Rust 1.69 🌸 [arithmetic_side_effects] Fix rust-lang#10590 Update to a compiletest-rs version that requires `//@` for commands [arithmetic_side_effects] Cache symbols Fix typo in significant_drop_tightening Fix `#[allow(clippy::enum_variant_names)]` directly on variants make [`len_zero`] lint not spanning over parenthesis clippy: drop unused semver crate Ignore `impl Trait`(s) Add lint `items_after_test_module` Compact emmited lint Bump Clippy version -> 0.1.71 Bump nightly version -> 2023-04-23 Fix dogfood test Dont suggest suboptimal_flops unavailable in nostd Fixes rust-lang#10634 use is_inside_const_context query for in_constant split test into 2 Remove check for `lib.register_*` and `src/docs*` in `cargo dev update_lints` This reverts commit 22d435b. Detect if expressions with boolean assignments to the same target Spelling * applying * binding * complex * constituent * demonstrate * desugaring * exact * expression * for * functionalities * github * implementation * infers * multiple conflicting traits * mutable * necessarily * nightly * nonexistent * optional * parameter * reassignments * resources * substitution * suggestion * that * that array is * using the Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Rewrite search_same description Ignore `shadow` warns in code from macro expansions fix false positive Update allow_attributes_false_positive.rs also check for rest pat in `redundant_pattern_matching` Improve the help message + add a help span don't check if from macro invocation run cargo dev fmt make cargo test pass use in_external_macro Catching, stray, commas, (I'll, never, learn, to, use, them, correctly) 😅 Add the warning to all documentation. add `semicolon_outside_block_if_singleline` lint make cargo test pass refactor make cargo test pass, again improve description a bit refactor config instead of new lint and don't panic make cargo test pass change names to not be implicitly negative use `//@` for commands in tests Update lint_configuration.md run linkcheck in Remark CI fix new lints link install nightly rust-docs run linkcheck without nightly toolchain remove nightly toolchain, add rust-docs component Test Remark Update basics.md Update basics.md Update basics.md update workflow add rust docs toolchain Update remark.yml workflow test manual test update book path add linkcheck book to CI Update lint_passes.md Fix rust-lang#10713 and move the tests to a subdir Remove useless span magic Change module import system Rename items + Delete `imported_module.stderr` new lint: `while_pop_unwrap` elide lifetimes, get rid of glob import move lint to loops, emit proper suggestion, more tests remove unnecessary reference make PopStmt copy+clone rename lint to `manual_while_let_some` fix run-rustfix directive Clarify docs for RESULT_LARGE_ERR globally ignore `#[no_std]` crates Don't ignore `check_radians` Update macros.rs adds lint to detect construction of unit struct using `default` Using `default` to construct a unit struct increases code complexity and adds a function call. This can be avoided by simply removing the call to `default` and simply construct by name. fix diagnostic message style Co-authored-by: Ruby Lazuli <general@patchmixolydic.com> fixed span and corrected test output rename to plural form add more test cases fix failing tests add `rustfix` annotation fix lint docs Inherit stdout/stderr for `cargo dev dogfood` Bump nightly version -> 2023-05-05 Ignore expressions from macros in default_constructed_unit_structs new lint: clippy::ref_patterns Add missing word "are" Ignore `borrow_deref_ref` warnings in code from procedural macros. `Wildcard_imports` ignore `test.rs` files Really mini minor irrelevant change for formatting Now the lint ignores any crates with `--cfg test` Fix header Bump README copyright wip WIP WIP WIP Working Update trait_bounds.rs Update trait_bounds.rs Comments Comments Minimizing changes Fix config formatting, less indenting, more spacing needless_bool: do not simplify code if it loses comments add lint `manual_next_back` checks for manual reverse iteration (`.rev().next()`) of a `DoubleEndedIterator` Update actions/checkout Update actions/setup-node fix: warn on empty line outer AttrKind::DocComment changelog: [`empty_line_after_doc_comments`]: add lint for checking empty lines after rustdoc comments. Fixes: rust-lang#10395 Consider referenced allowed or hard-coded types fix rust-lang#10773 move `is_ty_alias` to `clippy_utils` flip1995: Stepping down from the reviewer rotation A step I was trying to avoid for way too long, but sadly necessary now. I hope I can come back stronger in a few months. Rebase and merge attempt number 2. Included sources to std::path in lint string. Rebase and merge attempt number 2. Fixed arguments in lint string. Renamed lint to join_absolute_path as per request. Ran cargo dev update_lints Ran cargo dev bless after a full cargo test Entered supposed changes, ran cargo dev fmt, test, and bless. initial step towards implementing C string literals rm diag item, use lang item Merge commit '371120bdbf58a331db5dcfb2d9cddc040f486de8' into clippyup Make the BUG_REPORT_URL configurable by tools This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy the entire hook implementation. - Switch clippy to the new hook This also adds a `extra_info` callback so clippy can include its own version number, which differs from rustc's. - Call `install_ice_hook` in rustfmt make (try_)subst_and_normalize_erasing_regions take EarlyBinder changes from review: add FIXME to clippy and change subst_identity to skip_binder in mir subst methods IAT: Introduce AliasKind::Inherent Drop uplifted clippy::drop_ref Drop uplifted clippy::drop_copy Drop uplifted clippy::forget_ref Drop uplifted clippy::forget_copy Exposes false negative in clippy's diverging_sub_expression Remove `LangItems::require` It's just a short wrapper used by `tcx.require_lang_item`. Deleting it gives us a negative diff. Exclude inherent projections from some alias ty matches Merge commit '435a8ad86c7a33bd7ffb91c59039943408d3b6aa' into clippyup Rename `drop_copy` lint to `dropping_copy_types` Rename `forget_copy` lint to `forgetting_copy_types` Rename `drop_ref` lint to `dropping_references` Rename `forget_ref` lint to `forgetting_references` Replace EarlyBinder(x) with EarlyBinder::new(x) Make EarlyBinder's inner value private; and fix all of the resulting errors Use `Cow` in `{D,Subd}iagnosticMessage`. Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment: ``` // FIXME(davidtwco): can a `Cow<'static, str>` be used here? ``` This commit answers that question in the affirmative. It's not the most compelling change ever, but it might be worth merging. This requires changing the `impl<'a> From<&'a str>` impls to `impl From<&'static str>`, which involves a bunch of knock-on changes that require/result in call sites being a little more precise about exactly what kind of string they use to create errors, and not just `&str`. This will result in fewer unnecessary allocations, though this will not have any notable perf effects given that these are error paths. Note that I was lazy within Clippy, using `to_string` in a few places to preserve the existing string imprecision. I could have used `impl Into<{D,Subd}iagnosticMessage>` in various places as is done in the compiler, but that would have required changes to *many* call sites (mostly changing `&format("...")` to `format!("...")`) which didn't seem worthwhile. Drop uplifted clippy::invalid_utf8_in_unchecked EarlyBinder::new -> EarlyBinder::bind Drop uplifted clippy::cast_ref_to_mut Use translatable diagnostics in `rustc_const_eval` Implement custom diagnostic for ConstParamTy Merge commit '30448e8cf98d4754350db0c959644564f317bc0f' into clippyup Rename `impl_defaultness` to `defaultness` Removed stable/unstable sort arg from into_sorted_stable_ord, fixed a few misc issues, added collect to UnordItems Whoops, submodule change was actually valid - undoing fixup Drop uplifted clippy::undropped_manually_drops Drop uplifted `clippy:cmp_nan` Extend `unused_must_use` to cover block exprs Add `AliasKind::Weak` for type aliases. Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases. Move WF goal to clause Move ConstEvaluatable to Clause Treat TAIT equation as always ambiguous in coherence Better error for non const `PartialEq` call generated by `match` Make `{Arc,Rc,Weak}::ptr_eq` ignore pointer metadata s/Clause/ClauseKind Support `ast::ExprKind::Become` in clippy Migrate item_bounds to ty::Clause Do not offer any of the suggestions in emit_coerce_suggestions for expr from destructuring assignment desugaring Support `hir::ExprKind::Become` in clippy Migrate predicates_of and caller_bounds to Clause Provide more context for `rustc +nightly -Zunstable-options` on stable Make simd_shuffle_indices use valtrees Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyup Fix valtree changes Fix compile-test tests to work with the new ui_test crate Deal with fallout Patch clippy Move `TyCtxt::mk_x` to `Ty::new_x` where applicable Fix failing clippy tests Comments out the C string literals due to rust-lang/rust#113334 Fixes rust-lang#11121 Rename `adjustment::PointerCast` and variants using it to `PointerCoercion` It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum. Delete `to_string_in_format_args_incremental.rs` It fails CI and passes locally. It passes random directores in `-Cincremental` so maybe something's up. It shouldn't block us here. Drop uplifted `clippy::fn_null_check` Ignore flaky clippy tests. Suggest the correct variable name for `manual_let_else` Split if conditions by its semantics Remove old feature flag in code comment Since let_else feature has been stable in 1.65.0, it's now unnecessary Avoid renaming for TupleStruct with multiple arguments update spec fix: move specs in fire Fix: Some suggestions generated by the option_if_let_else lint did not compile bump up `regex-syntax` dependency version to 0.7.0 Ignoring `let_underscore_untyped` warnings in code from proc macros fixing fmt Checking for proc_macro not only when local.init is Some Remove unnecessary from example fix example heading in `string_slice` don't remove `dbg!` in arbitrary expressions handle nested macros and add tests for them Rename integer_arithmetic redundant_pattern_matching redundant_pattern_matching fix conflict with matches macro fix conflict with matches macro fix error test update a func fix reviewer comments fix reviewer comments: tests results update tests update test option Don't suggest unnameable types in box_default, let_underscore_untyped Search for inactive `cfg` attributes and empty macro expansion through the entire block Slightly refactor constant evaluation and add detection for empty macro expansion and `cfg`ed statements. Improve `SpanlessEq` * Don't consider expansions of different macros to be the same, even if they expand to the same tokens * Don't consider `cfg!` expansions to be equal if they check different configs. enhance `needless_collect` Updates `needless_collect` to lint for collecting into a method or function argument thats taking an `IntoIterator` (for example `extend`). Every `Iterator` trivially implements `IntoIterator` and colleting it only causes an unnecessary allocation. Add new `UNIQUE_CFG_CONDITION` lint Add UI test for UNIQUE_CFG_CONDITION Update CHANGELOG Add check for empty cfg `all` condition Update urls in Type Checking Bump nightly version -> 2023-05-20 [`match_wild_err_arm`]: do not lint in const contexts consider array initializer for `large_stack_arrays` add test case for rust-lang#10741 Unit tests highlighting unsafe match issue These unit tests generate non-compilable code. I did NOT `bless` them on purpose because the stderr output is not good. I'm surprised we don't auto-compile the suggestions here - is this something that can be easily enabled? See rust-lang#10808 Fix unsafe blocks Use #[rustfmt::skip] remove todo Run-rustfix needless_else: new lint to check for empty else clauses the implementation!! check msrv Update clippy_lints/src/casts/ptr_cast_constness.rs Co-authored-by: llogiq <bogusandre@gmail.com> add description and rename msrv tests change `clippy::version` to 1.71.0 Display the `needless_return` suggestion error out if lint name contains dash replace `-` instead of erroring out apply suggestion Co-authored-by: Philipp Krones <hello@philkrones.com> Address Dependabot alerts do not consider `await` in nested `async` blocks remove old span_lint point to `await` expr in note redundant pattern matches! result [`default_constructed_unit_structs`]: do not lint type aliases Ignore #[cfg]'d out code in needless_else Fix formatting of if let chain Some improvements to the manual_let_else lint suggestions * Replace variables inside | patterns in the if let: let v = if let V::A(v) | V::B(v) = v { v } else ... * Support nested patterns: let v = if let Ok(Ok(Ok(v))) = v { v } else ... * Support tuple structs with more than one arg: let v = V::W(v, _) = v { v } else ... * Correctly handle .. in tuple struct patterns: let v = V::X(v, ..) = v { v } else ... Fixing `invalid_regex` with invalid UTF8. Also, adding more test cases Update version attribute for 1.70 lints Changelog for Rust 1.70 🔨 Change changelog typos Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com> deps: drop serde feature from url actually, remove rustc-workspace-hack dependency too [`wildcard_imports`] Modules that contain `prelude` are also allowed This commit fixes rust-lang#10846 by checking if the path segment contains the word "prelude". Signed-off-by: Charalampos Mitrodimas <charmitro@gmail.com> fix issues 10836 change booleans file and update tests Remove lint name and category fields from the new lint issue form new lint: `missing_field_in_debug` move some strings into consts, more tests s/missing_field_in_debug/missing_fields_in_debug dont trigger in macro expansions make dogfood tests happy minor cleanups replace HashSet with FxHashSet replace match_def_path with match_type if_chain -> let chains, fix markdown, allow newtype pattern fmt consider string literal in `.field()` calls as used don't intern defined symbol, remove mentions of 'debug_tuple' special-case PD, account for field access through `Deref` don't lint enums, update note in lint description Explain which paths clippy searches for configuration in docs Explain path-search using a list Add spans to `clippy.toml` error messages Bump nightly version -> 2023-06-02 Bump Clippy version -> 0.1.72 add checking for cfg(features = ...) Update *Current stable* text in `CHANGELOG.md` Refresh Lint Configuration's looks emit `unnecessary_cast` on raw pointers as well ok actually appease CI I should always run cargo test before committing 😅 add generics in test also ensure generics with the same type are linted Use URL parameters for filter states This retains the settings during browser navigation and allows sharing links with additional configuration. Handle back/forward when using URL parameters for filter states Clippy Lints page - Delay updating of the URL in response to search input Update on blur, enter keypress, and a debounced delay of 1000 ms. This keeps the URL updated, but not distractingly so. Clippy Lints page - Do not show groups in URL parameters if reset to defaults Clippy Lints page - Fix path watch triggering Clippy Lints page - Do not show filters in URL if configured as default values only lint when `cast_from` and `cast_to`'s ty are the same weird manual_let_else: only add () around PatKind::Or at the top level At the top level, () are required, but on the levels below they are not. Support multi-binding situations as well as tuple patterns Support struct patterns new lint: `explicit_into_iter_fn_arg` dogfood update docs, simplify arg->param map, dont lint on chain merge `explicit_into_iter_fn_arg` into `useless_conversion` fix new failing proc macro tests add plural form to useless_conversion if depth > 0 Add lint to check lint formulation messages Fix lints that don't conform to the standard formulation refactor(test): Move attribute to lint level Fix suggestion on fully qualified syntax ignore `Foo::deref` altogether Add from_over_into replace for type in `Self` reference Ignore from_over_into if it contains Self Move bail into lint to prevent no-linting, move to unfixable don't lint `allow_attributes` on attributes from proc macros foiled again (forgot to run cargo test) Fix `attr_search_pat` for `#[cfg_attr]` remove tuple add test for `?` desugaring Update allow_attributes_without_reason.rs `to_xx_bytes` implemented, `from_xx_bytes` todo Mentioned in rust-lang#10765 implement `host_endian_bytes` and the other two weird grammar refine output unidiomatic `if_chain!` don't allocate the names use enum for `prefix` instead of `&str` Update endian_bytes.rs derive Copy/PartialEq for `Prefix` Remove `CARGO_UNSTABLE_SPARSE_REGISTRY` env from ci It is now the default to use the sparse registry Move redundant_clone to nursery Add a test that checks for old style test headers [`unnecessary_lazy_eval`]: don't lint on types with deref impl Bring up Rust lang #37612 as a known problem for let_and_return Compact issue link Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com> Add redundant type annotations lint Move `redundant_type_annotations` to restriction Extract common logic to function Add support to returned refs from `MethodCall` Add `Limitations` section make cast_possible_wrap not lint on conversions for sizes that cannot wrap, and make it work correctly for 16 bit {u,i}size add more info link Fix rust-lang#10498 Use type snippet instead of init expr for proc macro check check for `_` instead account for autoderef in eager_or_lazy don't call `type_of` on generic params Don't warn if there is a comment between else and curly bracket make `useless_vec` smarter allow the lint in a bunch of tests don't allow `as_slice` for now Adds new lint `arc_with_non_send_or_sync` Updating documentation and lint formatting. Adding extra check to ignore generic args. Swapping to matches macro. handle RangeInclusive function desugar actually don't lint for inclusive range Fix `useless_vec` suggestion in `for _ in vec![..]` Ignore more pointer types in `unnecessary_cast` check that the adjusted receiver type matches target add the `excessive_*` style lints change it to nursery category add `excessive_nesting` Close code block in example couple more notes decided against reinventing the wheel check non-inline modules, ignore all macros work with lint attributes move to `complexity` but don't lint by default Check if from proc macro and better tests remove revisions fix rust-lang#10776 actually fix it also lint single expression blocks Update mixed_read_write_in_expression.rs Update diverging_sub_expression.stderr ensure there are no stmts for expr check refactor Update excessive_nesting.rs Update excessive_nesting.rs allow disabling module inception on private modules allow disabling module inception on private modules Direct towards late passes in `cargo dev new_lint` handle exponent without digits add test ignore more type aliases in unnecessary_cast ignore more type aliases in unnecessary_cast Update unnecessary_cast.stderr Add `needless_if` lint make cargo test pass add description add description don't lint on `if let` don't lint on `if let` Update needless_if.fixed Stop visiting once it's found `Let` Extend `explicit_iter_loop` to all types Split `for_loops` tests Fix `explicit_into_iter_loop` with mutable references Reborrow mutable references in `explicit_iter_loop` Fix rust-lang#10504, don't lint on derived code refactor Update trait_bounds.rs `ty_search_pat` `impl WithSearchPat for Ty` Update check_proc_macro.rs Add lint `single_letter_idents` rename the lint make cargo test pass + example ignore generics and allow arbitrary threshold make it work for locals as well oopos add to tests and configuration `cargo collect-metadata` refactor and add link to issue new lint: `large_stack_frames` `cargo dev update_lints` fmt use span_lint_and_note rename "drawbacks" to "known issues" make lint description easier to read, prevent ICE fix rebase weirdness update lint_configuration.md Don't ling `as_conversions` in proc macros [`useless_vec`]: detect unnecessary `vec![_]` add- and fix existing tests Add test code Boilerplate for the new lint Add hook Add the lint to the lib Implement the lint Implement the lint for expect Implement the suggestion Recognize `Ok` Recognize `unwrap_or` methods Recognize `unwrap_or_else` method Track init and unwrap of expr Recognize `Err` Support suggesting panics Add more tests Preserve type annotations when present Fix all the other tests Don't lint non-statement/faux empty `needless_if`s Now `cargo collect-metadata` updates the `CHANGELOG.md` Remove dead code in `needless_pass_by_value` Fix `missing_const_for_fn` not checking `~const Destruct` use trait solver instead; created spaghetti code cleanup spaghetti code remove unnecessary checks remove `in_move` [`needless_lifetimes`]' suggestion now points at the lifetimes [`no_effect`]: suggest adding `return` if applicable make cargo test pass Revert "Make it `Unspecified`" This reverts commit 7748630. Make it `Unspecified` [`map_unwrap_or`]: don't lint when referenced variable is moved Ignore `main()` in `no_test` code fences run `cargo dev fmt` add main function to test itself [`derivable_impls`]: don't lint if expr unsize-coerces fmt dogfood fix internal lints Add lint [`single_range_in_vec_init`] refactor a bit [`unnecessary_fold`]: suggest turbofish if necessary get rid of unnecessary function pointer move check_fold_with_op function out from_over_into: Show suggestions for non-Self expanded paths [`match_same_arms`]: don't lint if `non_exhaustive_omitted_patterns` formatting :/ new lint: `drain_collect` take into account reborrowing when inserting `&mut` in sugg make clippy happy add a description add test case for not whole length, move sugg into variable add lint [`needless_clone_impl`] Update needless_impls.rs rename lint and disallow `clone_from` missing_panics_doc: pickup expect method bless address or allow clippy::missing_panics_doc in clippy-dev merge test improve grammer in comment sentence Co-authored-by: dswij <dharmasw@outlook.com> Refactor to make following commit pass single_match_else lint Make `--explain` subcommand return 1 for missing lints Ignore more type aliases in `unnecessary_cast` Adapt versions.html file to cleaned up gh-pages Fix version.py after deleting v* dirs I missed updating this file. I also ran black and isort over it. Adding configuration to allow safety comment above stmt containing unsafe block Addressing reviewer comments adding all ui tests to the configuration test as well Collecting metadata Exlude `todo!()` from `missing_panics_in_doc` `missing_panics_in_doc` bless test and add additional macro testcase new lint `single_call_fn` add test for closures Ignore functions annotated with `#[test]` Fix `find_format_arg_expr` when incremental compilation is enabled Fix rust-lang#10792 Dogfood Fix false positive of [self_named_module_files] and [mod_module_files] Move continue into if statement Co-authored-by: Catherine <114838443+Centri3@users.noreply.github.com> [`redundant_closure_call`]: handle nested closures fix docs don't unnecessarily walk more in visitor and add more tests Ignore in-proc-macros items use PlaceRef abstractions add non-test-case for suggesting const on functions accessing union fields allow safety comment above attributes [`single_match`]: don't lint if block contains comments add test for block comment and add note to description Don't lint `excessive_precision` on inf Add WebAssembly to allowed idents add WebAssembly to test [`borrow_as_ptr`]: Ignore temporaries use rustc's criteria for a temporary Don't lint `iter_nth_zero` in `next` include a ref if argument is not just a numeric literal use let chains, move assignments out of block, add tests declare needs_ref later [`type_repetition_in_bounds`]: respect msrv for combining maybe bounds put issue link between <> rename MSRV alias, add MSRV to lint doc update lint configuration Don't lint `ptr_arg` when return type uses Cow's lifetime [`format_push_string`]: look through match, if, if-let Avoid linting on procedural macros Lint `mem_forget` if fields are `Drop` move to `drop_forget_ref` make note less verbose Check if `if` conditions always evaluate to true in `never_loop` update changelog's data ranges Port clippy away from compiletest to ui_test Update tests Find the right `cargo-clippy` binary in CI Don't lint code from external macros add `needless_raw_string_hashes` lint add semicolon in doctest new lint `needless_raw_string` + refactor a bit Thanks, #112373, for the snippet at line 75! Update raw_strings.rs don't lint `needless_raw_string_hashes` when it's unnecessary change category and refactor Update raw_strings.rs Revert "new lints for visibility" This reverts commit 0e5a537. new lints for visibility Fix compile-test under cargo nextest Add BLESS for compile-test and some cleanup new lint: `manual_range_pattern` manual_range_pattern -> manual_range_patterns Use substring matching for TESTNAME new lints for visibility Change category and update to `ui_test` [`unused_async`]: don't lint on async trait impls move `is_in_trait_method` to utils and rename [`option_if_let_else`]: suggest `.as_ref()` if `&Option<_>` allow dead code in the test [`question_mark`]: don't lint inside of `try` block lint in nested bodies if `try` is in outer body suggests `is_some_and` over `map().unwrap_or(false)` changed the msrv to 1.70 to suggest `is_some_and` if the msrv is not >= 1.70 then the `map_or` is suggested instead of `is_some_and` (even when `unwrap_or` returns false) now passes dogfood by wrapping unwrap_recv and unwrap_arg into a tuple was previously failing due to `check` having to many arguments. Revert "now passes dogfood by wrapping unwrap_recv and unwrap_arg into a tuple" This reverts commit 7b91844. ignore too_many_arguments on `check` changed msrv name for consistency & changed nested if for style updated list of lints that use msrv ran `cargo collect-metadata` New lint [`redundant_rest_pattern`] Rename the lint Add note to remove `if` statement altogether Fix rust-lang#10413 Dogfood Bump nightly version -> 2023-06-29 Make `eq_op` suggest `.is_nan()` New lint `tuple_array_conversions` Add msrv check and make test pass Fix FP heavily refactor New lint `manual_try_fold` Add msrv tests Typo update docs address comments Fix typos Use `cargo build --tests` in CI let_and_return: lint 'static lifetimes, don't lint borrows in closures Add `SPEEDTEST` Fix dogfood Finally fix dogfood [`missing_fields_in_debug`]: make sure `self` is an adt new lint: `type_id_on_box` that was definitely not the right version add it to the methods lint pass add a few more test cases s/is_dyn_trait/is_dyn_any [`arc_with_non_send_sync`]: look for nested type parameters [`useless_vec`]: use the source span Don't lint manual_let_else in cases where the question mark operator would work Also, lint question_mark for `let...else` clauses that can be simplified to use `?`. This lint isn't perfect as it doesn't support the unstable try blocks. Fix the now stricter lint in manual_rem_euclid.rs Put into one pass Don't suppress manual_let_else if question_mark is allowed If question_mark is allowed, there is no overlap any more, so we can just not suppress it. Move pat_and_expr_can_be_question_mark into clippy_utils Fix FP [`needless_raw_string_hashes`] [`useless_vec`]: add more tests for macro combinations new lint: `read_line_without_trim` add test cases for u32, f32, bool, String Fix regex lints for regex 1.9.0 arc_with_non_send_sync: reword and move to suspicious Pass correct substs to `implements_trait` in `incorrect_impls` `Copy<T>` does in fact not exist. The substs on the trait_ref contain the `Self` type of the impl as the first parameter, so passing that to `implements_trait`, which then nicely prepends the `Self` type for us does not end will. Fix changelog PR listings, create them automatically in `fetch_prs_between.sh` implement `manual_partial_ord_impl` first try at this rename to `manual_partial_ord_and_ord_impl` cargo dev fmt cargo test passes cargo test passes refactor a lil Update bool_comparison.stderr heavily refactor + bump `clippy::version` refactor refactor check bounds to increase accuracy, and add todos use `other` instead of `self` refactor `manual_float_methods` Make suggestion give multiple alternatives Refactor, remove `Constant::to_bits` [significant_drop_tightening] Fix rust-lang#11128 Dogfood Add test for rust-lang#10535 Fix rust-lang#10535 Add needless_pass_by_ref lint Add UI test for `needless_pass_by_ref_mut` Update UI tests with new `needless_pass_by_ref_mut` lint Fix warnings of `needless_pass_by_ref_mut` in clippy Add warning for `NEEDLESS_PASS_BY_REF_MUT` lint about the fact that it changes API Add warning about semver compatibility if it's a public function "try this" -> "try" [`unnecessary_literal_unwrap`]: don't lint if binding initializer is expn [`manual_range_patterns`]: lint negative values [`manual_range_patterns`]: document what range we don't lint changelog: Fix typo in `needless_pass_by_ref_mut` lint description adjust applicability and suggest making binding mutable Use depinfo to discover UI test dependencies [`unnecessary_literal_unwrap`]: lint `unwrap_unchecked` [`unnecessary_literal_unwrap`]: also handle unwrap_err_unchecked Update version attribute for 1.71 lints Changelog for Rust 1.71 👑 Changelog: Add disclaimer about the new format [`panic_in_result_fn`] remove `todo!`, `unimplemented!`, `unreachable!` This commit fixes rust-lang#11025 by removing checks for `todo!`, `unimplemented!` and `unreachable!`. Signed-off-by: Panagiotis Foliadis <pfoliadis@hotmail.com> Add "Known problems" section to `needless_borrow` documentation [`tuple_array_conversions`]: move from `complexity` to `nursery` Due to outstanding issues: * rust-lang#11082 * rust-lang#11085 * rust-lang#11100 (rust-lang#11105) * rust-lang#11124 * rust-lang#11144 [`arithmetic_side_effect`]: allow different rhs type Add `imports_granularity = "Module"` to rustfmt.toml Trigger a rebuild when CLIPPY_CONF_DIR changes Set `unnecessary_cast` suggestion to `MaybeIncorrect` for pointer casts Removing casts may cause type inference to stop working which requires manual intervention Bump Clippy version -> 0.1.73 Bump nightly version -> 2023-07-14 renamed lint rebase attempt
ofeeg
added a commit
to ofeeg/rust-clippy
that referenced
this issue
Aug 15, 2023
initial step towards implementing C string literals rm diag item, use lang item Merge commit '371120bdbf58a331db5dcfb2d9cddc040f486de8' into clippyup Make the BUG_REPORT_URL configurable by tools This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy the entire hook implementation. - Switch clippy to the new hook This also adds a `extra_info` callback so clippy can include its own version number, which differs from rustc's. - Call `install_ice_hook` in rustfmt make (try_)subst_and_normalize_erasing_regions take EarlyBinder changes from review: add FIXME to clippy and change subst_identity to skip_binder in mir subst methods IAT: Introduce AliasKind::Inherent Drop uplifted clippy::drop_ref Drop uplifted clippy::drop_copy Drop uplifted clippy::forget_ref Drop uplifted clippy::forget_copy Exposes false negative in clippy's diverging_sub_expression Remove `LangItems::require` It's just a short wrapper used by `tcx.require_lang_item`. Deleting it gives us a negative diff. Exclude inherent projections from some alias ty matches Merge commit '435a8ad86c7a33bd7ffb91c59039943408d3b6aa' into clippyup Rename `drop_copy` lint to `dropping_copy_types` Rename `forget_copy` lint to `forgetting_copy_types` Rename `drop_ref` lint to `dropping_references` Rename `forget_ref` lint to `forgetting_references` Replace EarlyBinder(x) with EarlyBinder::new(x) Make EarlyBinder's inner value private; and fix all of the resulting errors Use `Cow` in `{D,Subd}iagnosticMessage`. Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment: ``` // FIXME(davidtwco): can a `Cow<'static, str>` be used here? ``` This commit answers that question in the affirmative. It's not the most compelling change ever, but it might be worth merging. This requires changing the `impl<'a> From<&'a str>` impls to `impl From<&'static str>`, which involves a bunch of knock-on changes that require/result in call sites being a little more precise about exactly what kind of string they use to create errors, and not just `&str`. This will result in fewer unnecessary allocations, though this will not have any notable perf effects given that these are error paths. Note that I was lazy within Clippy, using `to_string` in a few places to preserve the existing string imprecision. I could have used `impl Into<{D,Subd}iagnosticMessage>` in various places as is done in the compiler, but that would have required changes to *many* call sites (mostly changing `&format("...")` to `format!("...")`) which didn't seem worthwhile. Drop uplifted clippy::invalid_utf8_in_unchecked EarlyBinder::new -> EarlyBinder::bind Drop uplifted clippy::cast_ref_to_mut Use translatable diagnostics in `rustc_const_eval` Implement custom diagnostic for ConstParamTy Merge commit '30448e8cf98d4754350db0c959644564f317bc0f' into clippyup Rename `impl_defaultness` to `defaultness` Removed stable/unstable sort arg from into_sorted_stable_ord, fixed a few misc issues, added collect to UnordItems Whoops, submodule change was actually valid - undoing fixup Drop uplifted clippy::undropped_manually_drops Drop uplifted `clippy:cmp_nan` Extend `unused_must_use` to cover block exprs Add `AliasKind::Weak` for type aliases. Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases. Move WF goal to clause Move ConstEvaluatable to Clause Treat TAIT equation as always ambiguous in coherence Better error for non const `PartialEq` call generated by `match` Make `{Arc,Rc,Weak}::ptr_eq` ignore pointer metadata s/Clause/ClauseKind Support `ast::ExprKind::Become` in clippy Migrate item_bounds to ty::Clause Do not offer any of the suggestions in emit_coerce_suggestions for expr from destructuring assignment desugaring Support `hir::ExprKind::Become` in clippy Migrate predicates_of and caller_bounds to Clause Provide more context for `rustc +nightly -Zunstable-options` on stable Make simd_shuffle_indices use valtrees Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyup Fix valtree changes Fix compile-test tests to work with the new ui_test crate Deal with fallout Patch clippy Move `TyCtxt::mk_x` to `Ty::new_x` where applicable Fix failing clippy tests Comments out the C string literals due to rust-lang/rust#113334 Fixes rust-lang#11121 Rename `adjustment::PointerCast` and variants using it to `PointerCoercion` It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum. Delete `to_string_in_format_args_incremental.rs` It fails CI and passes locally. It passes random directores in `-Cincremental` so maybe something's up. It shouldn't block us here. Drop uplifted `clippy::fn_null_check` Ignore flaky clippy tests. Suggest the correct variable name for `manual_let_else` Split if conditions by its semantics Remove old feature flag in code comment Since let_else feature has been stable in 1.65.0, it's now unnecessary Avoid renaming for TupleStruct with multiple arguments update spec fix: move specs in fire Fix: Some suggestions generated by the option_if_let_else lint did not compile bump up `regex-syntax` dependency version to 0.7.0 Ignoring `let_underscore_untyped` warnings in code from proc macros fixing fmt Checking for proc_macro not only when local.init is Some Remove unnecessary from example fix example heading in `string_slice` don't remove `dbg!` in arbitrary expressions handle nested macros and add tests for them Rename integer_arithmetic redundant_pattern_matching redundant_pattern_matching fix conflict with matches macro fix conflict with matches macro fix error test update a func fix reviewer comments fix reviewer comments: tests results update tests update test option Don't suggest unnameable types in box_default, let_underscore_untyped Search for inactive `cfg` attributes and empty macro expansion through the entire block Slightly refactor constant evaluation and add detection for empty macro expansion and `cfg`ed statements. Improve `SpanlessEq` * Don't consider expansions of different macros to be the same, even if they expand to the same tokens * Don't consider `cfg!` expansions to be equal if they check different configs. enhance `needless_collect` Updates `needless_collect` to lint for collecting into a method or function argument thats taking an `IntoIterator` (for example `extend`). Every `Iterator` trivially implements `IntoIterator` and colleting it only causes an unnecessary allocation. Add new `UNIQUE_CFG_CONDITION` lint Add UI test for UNIQUE_CFG_CONDITION Update CHANGELOG Add check for empty cfg `all` condition Update urls in Type Checking Bump nightly version -> 2023-05-20 [`match_wild_err_arm`]: do not lint in const contexts consider array initializer for `large_stack_arrays` add test case for rust-lang#10741 Unit tests highlighting unsafe match issue These unit tests generate non-compilable code. I did NOT `bless` them on purpose because the stderr output is not good. I'm surprised we don't auto-compile the suggestions here - is this something that can be easily enabled? See rust-lang#10808 Fix unsafe blocks Use #[rustfmt::skip] remove todo Run-rustfix needless_else: new lint to check for empty else clauses the implementation!! check msrv Update clippy_lints/src/casts/ptr_cast_constness.rs Co-authored-by: llogiq <bogusandre@gmail.com> add description and rename msrv tests change `clippy::version` to 1.71.0 Display the `needless_return` suggestion error out if lint name contains dash replace `-` instead of erroring out apply suggestion Co-authored-by: Philipp Krones <hello@philkrones.com> Address Dependabot alerts do not consider `await` in nested `async` blocks remove old span_lint point to `await` expr in note redundant pattern matches! result [`default_constructed_unit_structs`]: do not lint type aliases Ignore #[cfg]'d out code in needless_else Fix formatting of if let chain Some improvements to the manual_let_else lint suggestions * Replace variables inside | patterns in the if let: let v = if let V::A(v) | V::B(v) = v { v } else ... * Support nested patterns: let v = if let Ok(Ok(Ok(v))) = v { v } else ... * Support tuple structs with more than one arg: let v = V::W(v, _) = v { v } else ... * Correctly handle .. in tuple struct patterns: let v = V::X(v, ..) = v { v } else ... Fixing `invalid_regex` with invalid UTF8. Also, adding more test cases Update version attribute for 1.70 lints Changelog for Rust 1.70 🔨 Change changelog typos Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com> deps: drop serde feature from url actually, remove rustc-workspace-hack dependency too [`wildcard_imports`] Modules that contain `prelude` are also allowed This commit fixes rust-lang#10846 by checking if the path segment contains the word "prelude". Signed-off-by: Charalampos Mitrodimas <charmitro@gmail.com> fix issues 10836 change booleans file and update tests Remove lint name and category fields from the new lint issue form new lint: `missing_field_in_debug` move some strings into consts, more tests s/missing_field_in_debug/missing_fields_in_debug dont trigger in macro expansions make dogfood tests happy minor cleanups replace HashSet with FxHashSet replace match_def_path with match_type if_chain -> let chains, fix markdown, allow newtype pattern fmt consider string literal in `.field()` calls as used don't intern defined symbol, remove mentions of 'debug_tuple' special-case PD, account for field access through `Deref` don't lint enums, update note in lint description Explain which paths clippy searches for configuration in docs Explain path-search using a list Add spans to `clippy.toml` error messages Bump nightly version -> 2023-06-02 Bump Clippy version -> 0.1.72 add checking for cfg(features = ...) Update *Current stable* text in `CHANGELOG.md` Refresh Lint Configuration's looks emit `unnecessary_cast` on raw pointers as well ok actually appease CI I should always run cargo test before committing 😅 add generics in test also ensure generics with the same type are linted Use URL parameters for filter states This retains the settings during browser navigation and allows sharing links with additional configuration. Handle back/forward when using URL parameters for filter states Clippy Lints page - Delay updating of the URL in response to search input Update on blur, enter keypress, and a debounced delay of 1000 ms. This keeps the URL updated, but not distractingly so. Clippy Lints page - Do not show groups in URL parameters if reset to defaults Clippy Lints page - Fix path watch triggering Clippy Lints page - Do not show filters in URL if configured as default values only lint when `cast_from` and `cast_to`'s ty are the same weird manual_let_else: only add () around PatKind::Or at the top level At the top level, () are required, but on the levels below they are not. Support multi-binding situations as well as tuple patterns Support struct patterns new lint: `explicit_into_iter_fn_arg` dogfood update docs, simplify arg->param map, dont lint on chain merge `explicit_into_iter_fn_arg` into `useless_conversion` fix new failing proc macro tests add plural form to useless_conversion if depth > 0 Add lint to check lint formulation messages Fix lints that don't conform to the standard formulation refactor(test): Move attribute to lint level Fix suggestion on fully qualified syntax ignore `Foo::deref` altogether Add from_over_into replace for type in `Self` reference Ignore from_over_into if it contains Self Move bail into lint to prevent no-linting, move to unfixable don't lint `allow_attributes` on attributes from proc macros foiled again (forgot to run cargo test) Fix `attr_search_pat` for `#[cfg_attr]` remove tuple add test for `?` desugaring Update allow_attributes_without_reason.rs `to_xx_bytes` implemented, `from_xx_bytes` todo Mentioned in rust-lang#10765 implement `host_endian_bytes` and the other two weird grammar refine output unidiomatic `if_chain!` don't allocate the names use enum for `prefix` instead of `&str` Update endian_bytes.rs derive Copy/PartialEq for `Prefix` Remove `CARGO_UNSTABLE_SPARSE_REGISTRY` env from ci It is now the default to use the sparse registry Move redundant_clone to nursery Add a test that checks for old style test headers [`unnecessary_lazy_eval`]: don't lint on types with deref impl Bring up Rust lang #37612 as a known problem for let_and_return Compact issue link Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com> Add redundant type annotations lint Move `redundant_type_annotations` to restriction Extract common logic to function Add support to returned refs from `MethodCall` Add `Limitations` section make cast_possible_wrap not lint on conversions for sizes that cannot wrap, and make it work correctly for 16 bit {u,i}size add more info link Fix rust-lang#10498 Use type snippet instead of init expr for proc macro check check for `_` instead account for autoderef in eager_or_lazy don't call `type_of` on generic params Don't warn if there is a comment between else and curly bracket make `useless_vec` smarter allow the lint in a bunch of tests don't allow `as_slice` for now Adds new lint `arc_with_non_send_or_sync` Updating documentation and lint formatting. Adding extra check to ignore generic args. Swapping to matches macro. handle RangeInclusive function desugar actually don't lint for inclusive range Fix `useless_vec` suggestion in `for _ in vec![..]` Ignore more pointer types in `unnecessary_cast` check that the adjusted receiver type matches target add the `excessive_*` style lints change it to nursery category add `excessive_nesting` Close code block in example couple more notes decided against reinventing the wheel check non-inline modules, ignore all macros work with lint attributes move to `complexity` but don't lint by default Check if from proc macro and better tests remove revisions fix rust-lang#10776 actually fix it also lint single expression blocks Update mixed_read_write_in_expression.rs Update diverging_sub_expression.stderr ensure there are no stmts for expr check refactor Update excessive_nesting.rs Update excessive_nesting.rs allow disabling module inception on private modules allow disabling module inception on private modules Direct towards late passes in `cargo dev new_lint` handle exponent without digits add test ignore more type aliases in unnecessary_cast ignore more type aliases in unnecessary_cast Update unnecessary_cast.stderr Add `needless_if` lint make cargo test pass add description add description don't lint on `if let` don't lint on `if let` Update needless_if.fixed Stop visiting once it's found `Let` Extend `explicit_iter_loop` to all types Split `for_loops` tests Fix `explicit_into_iter_loop` with mutable references Reborrow mutable references in `explicit_iter_loop` Fix rust-lang#10504, don't lint on derived code refactor Update trait_bounds.rs `ty_search_pat` `impl WithSearchPat for Ty` Update check_proc_macro.rs Add lint `single_letter_idents` rename the lint make cargo test pass + example ignore generics and allow arbitrary threshold make it work for locals as well oopos add to tests and configuration `cargo collect-metadata` refactor and add link to issue new lint: `large_stack_frames` `cargo dev update_lints` fmt use span_lint_and_note rename "drawbacks" to "known issues" make lint description easier to read, prevent ICE fix rebase weirdness update lint_configuration.md Don't ling `as_conversions` in proc macros [`useless_vec`]: detect unnecessary `vec![_]` add- and fix existing tests Add test code Boilerplate for the new lint Add hook Add the lint to the lib Implement the lint Implement the lint for expect Implement the suggestion Recognize `Ok` Recognize `unwrap_or` methods Recognize `unwrap_or_else` method Track init and unwrap of expr Recognize `Err` Support suggesting panics Add more tests Preserve type annotations when present Fix all the other tests Don't lint non-statement/faux empty `needless_if`s Now `cargo collect-metadata` updates the `CHANGELOG.md` Remove dead code in `needless_pass_by_value` Fix `missing_const_for_fn` not checking `~const Destruct` use trait solver instead; created spaghetti code cleanup spaghetti code remove unnecessary checks remove `in_move` [`needless_lifetimes`]' suggestion now points at the lifetimes [`no_effect`]: suggest adding `return` if applicable make cargo test pass Revert "Make it `Unspecified`" This reverts commit 7748630. Make it `Unspecified` [`map_unwrap_or`]: don't lint when referenced variable is moved Ignore `main()` in `no_test` code fences run `cargo dev fmt` add main function to test itself [`derivable_impls`]: don't lint if expr unsize-coerces fmt dogfood fix internal lints Add lint [`single_range_in_vec_init`] refactor a bit [`unnecessary_fold`]: suggest turbofish if necessary get rid of unnecessary function pointer move check_fold_with_op function out from_over_into: Show suggestions for non-Self expanded paths [`match_same_arms`]: don't lint if `non_exhaustive_omitted_patterns` formatting :/ new lint: `drain_collect` take into account reborrowing when inserting `&mut` in sugg make clippy happy add a description add test case for not whole length, move sugg into variable add lint [`needless_clone_impl`] Update needless_impls.rs rename lint and disallow `clone_from` missing_panics_doc: pickup expect method bless address or allow clippy::missing_panics_doc in clippy-dev merge test improve grammer in comment sentence Co-authored-by: dswij <dharmasw@outlook.com> Refactor to make following commit pass single_match_else lint Make `--explain` subcommand return 1 for missing lints Ignore more type aliases in `unnecessary_cast` Adapt versions.html file to cleaned up gh-pages Fix version.py after deleting v* dirs I missed updating this file. I also ran black and isort over it. Adding configuration to allow safety comment above stmt containing unsafe block Addressing reviewer comments adding all ui tests to the configuration test as well Collecting metadata Exlude `todo!()` from `missing_panics_in_doc` `missing_panics_in_doc` bless test and add additional macro testcase new lint `single_call_fn` add test for closures Ignore functions annotated with `#[test]` Fix `find_format_arg_expr` when incremental compilation is enabled Fix rust-lang#10792 Dogfood Fix false positive of [self_named_module_files] and [mod_module_files] Move continue into if statement Co-authored-by: Catherine <114838443+Centri3@users.noreply.github.com> [`redundant_closure_call`]: handle nested closures fix docs don't unnecessarily walk more in visitor and add more tests Ignore in-proc-macros items use PlaceRef abstractions add non-test-case for suggesting const on functions accessing union fields allow safety comment above attributes [`single_match`]: don't lint if block contains comments add test for block comment and add note to description Don't lint `excessive_precision` on inf Add WebAssembly to allowed idents add WebAssembly to test [`borrow_as_ptr`]: Ignore temporaries use rustc's criteria for a temporary Don't lint `iter_nth_zero` in `next` include a ref if argument is not just a numeric literal use let chains, move assignments out of block, add tests declare needs_ref later [`type_repetition_in_bounds`]: respect msrv for combining maybe bounds put issue link between <> rename MSRV alias, add MSRV to lint doc update lint configuration Don't lint `ptr_arg` when return type uses Cow's lifetime [`format_push_string`]: look through match, if, if-let Avoid linting on procedural macros Lint `mem_forget` if fields are `Drop` move to `drop_forget_ref` make note less verbose Check if `if` conditions always evaluate to true in `never_loop` update changelog's data ranges Port clippy away from compiletest to ui_test Update tests Find the right `cargo-clippy` binary in CI Don't lint code from external macros add `needless_raw_string_hashes` lint add semicolon in doctest new lint `needless_raw_string` + refactor a bit Thanks, #112373, for the snippet at line 75! Update raw_strings.rs don't lint `needless_raw_string_hashes` when it's unnecessary change category and refactor Update raw_strings.rs Revert "new lints for visibility" This reverts commit 0e5a537. new lints for visibility Fix compile-test under cargo nextest Add BLESS for compile-test and some cleanup new lint: `manual_range_pattern` manual_range_pattern -> manual_range_patterns Use substring matching for TESTNAME new lints for visibility Change category and update to `ui_test` [`unused_async`]: don't lint on async trait impls move `is_in_trait_method` to utils and rename [`option_if_let_else`]: suggest `.as_ref()` if `&Option<_>` allow dead code in the test [`question_mark`]: don't lint inside of `try` block lint in nested bodies if `try` is in outer body suggests `is_some_and` over `map().unwrap_or(false)` changed the msrv to 1.70 to suggest `is_some_and` if the msrv is not >= 1.70 then the `map_or` is suggested instead of `is_some_and` (even when `unwrap_or` returns false) now passes dogfood by wrapping unwrap_recv and unwrap_arg into a tuple was previously failing due to `check` having to many arguments. Revert "now passes dogfood by wrapping unwrap_recv and unwrap_arg into a tuple" This reverts commit 7b91844. ignore too_many_arguments on `check` changed msrv name for consistency & changed nested if for style updated list of lints that use msrv ran `cargo collect-metadata` New lint [`redundant_rest_pattern`] Rename the lint Add note to remove `if` statement altogether Fix rust-lang#10413 Dogfood Bump nightly version -> 2023-06-29 Make `eq_op` suggest `.is_nan()` New lint `tuple_array_conversions` Add msrv check and make test pass Fix FP heavily refactor New lint `manual_try_fold` Add msrv tests Typo update docs address comments Fix typos Use `cargo build --tests` in CI let_and_return: lint 'static lifetimes, don't lint borrows in closures Add `SPEEDTEST` Fix dogfood Finally fix dogfood [`missing_fields_in_debug`]: make sure `self` is an adt new lint: `type_id_on_box` that was definitely not the right version add it to the methods lint pass add a few more test cases s/is_dyn_trait/is_dyn_any [`arc_with_non_send_sync`]: look for nested type parameters [`useless_vec`]: use the source span Don't lint manual_let_else in cases where the question mark operator would work Also, lint question_mark for `let...else` clauses that can be simplified to use `?`. This lint isn't perfect as it doesn't support the unstable try blocks. Fix the now stricter lint in manual_rem_euclid.rs Put into one pass Don't suppress manual_let_else if question_mark is allowed If question_mark is allowed, there is no overlap any more, so we can just not suppress it. Move pat_and_expr_can_be_question_mark into clippy_utils Fix FP [`needless_raw_string_hashes`] [`useless_vec`]: add more tests for macro combinations new lint: `read_line_without_trim` add test cases for u32, f32, bool, String Fix regex lints for regex 1.9.0 arc_with_non_send_sync: reword and move to suspicious Pass correct substs to `implements_trait` in `incorrect_impls` `Copy<T>` does in fact not exist. The substs on the trait_ref contain the `Self` type of the impl as the first parameter, so passing that to `implements_trait`, which then nicely prepends the `Self` type for us does not end will. Fix changelog PR listings, create them automatically in `fetch_prs_between.sh` implement `manual_partial_ord_impl` first try at this rename to `manual_partial_ord_and_ord_impl` cargo dev fmt cargo test passes cargo test passes refactor a lil Update bool_comparison.stderr heavily refactor + bump `clippy::version` refactor refactor check bounds to increase accuracy, and add todos use `other` instead of `self` refactor `manual_float_methods` Make suggestion give multiple alternatives Refactor, remove `Constant::to_bits` [significant_drop_tightening] Fix rust-lang#11128 Dogfood Add test for rust-lang#10535 Fix rust-lang#10535 Add needless_pass_by_ref lint Add UI test for `needless_pass_by_ref_mut` Update UI tests with new `needless_pass_by_ref_mut` lint Fix warnings of `needless_pass_by_ref_mut` in clippy Add warning for `NEEDLESS_PASS_BY_REF_MUT` lint about the fact that it changes API Add warning about semver compatibility if it's a public function "try this" -> "try" [`unnecessary_literal_unwrap`]: don't lint if binding initializer is expn [`manual_range_patterns`]: lint negative values [`manual_range_patterns`]: document what range we don't lint changelog: Fix typo in `needless_pass_by_ref_mut` lint description adjust applicability and suggest making binding mutable Use depinfo to discover UI test dependencies [`unnecessary_literal_unwrap`]: lint `unwrap_unchecked` [`unnecessary_literal_unwrap`]: also handle unwrap_err_unchecked Update version attribute for 1.71 lints Changelog for Rust 1.71 👑 Changelog: Add disclaimer about the new format [`panic_in_result_fn`] remove `todo!`, `unimplemented!`, `unreachable!` This commit fixes rust-lang#11025 by removing checks for `todo!`, `unimplemented!` and `unreachable!`. Signed-off-by: Panagiotis Foliadis <pfoliadis@hotmail.com> Add "Known problems" section to `needless_borrow` documentation [`tuple_array_conversions`]: move from `complexity` to `nursery` Due to outstanding issues: * rust-lang#11082 * rust-lang#11085 * rust-lang#11100 (rust-lang#11105) * rust-lang#11124 * rust-lang#11144 [`arithmetic_side_effect`]: allow different rhs type Add `imports_granularity = "Module"` to rustfmt.toml Trigger a rebuild when CLIPPY_CONF_DIR changes Set `unnecessary_cast` suggestion to `MaybeIncorrect` for pointer casts Removing casts may cause type inference to stop working which requires manual intervention Bump Clippy version -> 0.1.73 Bump nightly version -> 2023-07-14 renamed lint
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
I tried this code:
However, using
.into()
in this situation doesn't work, as the compiler infers the unsized type[f64]
:produces:
Using
<[T; N]>::from
works - however, IMO this code is significantly less readable:I would argue that the original code is the most readable in this situation (constructing a slice from a tuple), and this lint should not fire when a slice is involved.
Lint Name
tuple_array_conversions
Reproducer
I tried this code:
However, using
.into()
in this situation doesn't work, as the compiler infers the unsized type[f64]
:produces:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: