about summary refs log tree commit diff
path: root/book/src
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2025-01-09 18:00:37 +0100
committerPhilipp Krones <hello@philkrones.com>2025-01-09 18:00:37 +0100
commitb5bf09e57afa50a2ecc9bfc07bad4ef64d9df447 (patch)
treecf262aea51c147a0348a7112966198ea63fc0303 /book/src
parent11f38ade90a2e1f9cee925260ffbe8bc0e3ad761 (diff)
parent894e87cd5160a2198940a35dc105ce6e46d9763e (diff)
downloadrust-b5bf09e57afa50a2ecc9bfc07bad4ef64d9df447.tar.gz
rust-b5bf09e57afa50a2ecc9bfc07bad4ef64d9df447.zip
Merge remote-tracking branch 'upstream/master' into rustup
Diffstat (limited to 'book/src')
-rw-r--r--book/src/development/infrastructure/changelog_update.md5
-rw-r--r--book/src/development/method_checking.md2
-rw-r--r--book/src/lint_configuration.md27
3 files changed, 33 insertions, 1 deletions
diff --git a/book/src/development/infrastructure/changelog_update.md b/book/src/development/infrastructure/changelog_update.md
index df9b1bbe18f..2b2c096b049 100644
--- a/book/src/development/infrastructure/changelog_update.md
+++ b/book/src/development/infrastructure/changelog_update.md
@@ -83,7 +83,12 @@ As section headers, we use:
 
 ```
 ### New Lints
+* Added [`LINT`] to `GROUP`
+
 ### Moves and Deprecations
+* Moved [`LINT`] to `GROUP` (From `GROUP`, now LEVEL-by-default)
+* Renamed `LINT` to [`LINT`]
+
 ### Enhancements
 ### False Positive Fixes
 ### Suggestion Fixes/Improvements
diff --git a/book/src/development/method_checking.md b/book/src/development/method_checking.md
index 9c5d4b516db..b3126024b99 100644
--- a/book/src/development/method_checking.md
+++ b/book/src/development/method_checking.md
@@ -21,7 +21,7 @@ use clippy_utils::is_trait_method;
 impl<'tcx> LateLintPass<'tcx> for OurFancyMethodLint {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
         // Check our expr is calling a method with pattern matching
-        if let hir::ExprKind::MethodCall(path, _, [self_arg, ..]) = &expr.kind
+        if let hir::ExprKind::MethodCall(path, _, [self_arg, ..], _) = &expr.kind
             // Check if the name of this method is `our_fancy_method`
             && path.ident.name.as_str() == "our_fancy_method"
             // We can check the type of the self argument whenever necessary.
diff --git a/book/src/lint_configuration.md b/book/src/lint_configuration.md
index ea1d7d11389..181e794e6e4 100644
--- a/book/src/lint_configuration.md
+++ b/book/src/lint_configuration.md
@@ -582,6 +582,33 @@ The maximum size of the `Err`-variant in a `Result` returned from a function
 * [`result_large_err`](https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err)
 
 
+## `lint-inconsistent-struct-field-initializers`
+Whether to suggest reordering constructor fields when initializers are present.
+
+Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
+suggested code would compile, it can change semantics if the initializer expressions have side effects. The
+following example [from rust-clippy#11846] shows how the suggestion can run into borrow check errors:
+
+```rust
+struct MyStruct {
+    vector: Vec<u32>,
+    length: usize
+}
+fn main() {
+    let vector = vec![1,2,3];
+    MyStruct { length: vector.len(), vector};
+}
+```
+
+[from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924
+
+**Default Value:** `false`
+
+---
+**Affected lints:**
+* [`inconsistent_struct_constructor`](https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_struct_constructor)
+
+
 ## `literal-representation-threshold`
 The lower bound for linting decimal literals