Skip to content

Commit b484c87

Browse files
committed
Auto merge of rust-lang#114310 - flip1995:clippyup, r=Manishearth
Update Clippy r? `@Manishearth` This is a bit delayed, because I thought it is a difficult conflict resolution and didn't have time for that over the weekend. Turns out, I just used the wrong merge base and it was actually easy... Don't do syncs in the middle of the night (even though I broke this rule with this PR again).
2 parents 706a4d9 + 53f09d9 commit b484c87

File tree

215 files changed

+7968
-2143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+7968
-2143
lines changed

Diff for: src/tools/clippy/.github/workflows/clippy_bors.yml

+15-14
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,14 @@ jobs:
187187
- name: Extract Binaries
188188
run: |
189189
DIR=$CARGO_TARGET_DIR/debug
190-
rm $DIR/deps/integration-*.d
191-
mv $DIR/deps/integration-* $DIR/integration
190+
find $DIR/deps/integration-* -executable ! -type d | xargs -I {} mv {} $DIR/integration
192191
find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
193-
rm -rf $CARGO_TARGET_DIR/release
194192
195193
- name: Upload Binaries
196-
uses: actions/upload-artifact@v1
194+
uses: actions/upload-artifact@v3
197195
with:
198-
name: target
199-
path: target
196+
name: binaries
197+
path: target/debug
200198

201199
integration:
202200
needs: integration_build
@@ -206,22 +204,20 @@ jobs:
206204
matrix:
207205
integration:
208206
- 'rust-lang/cargo'
209-
# FIXME: re-enable once fmt_macros is renamed in RLS
210-
# - 'rust-lang/rls'
211207
- 'rust-lang/chalk'
212208
- 'rust-lang/rustfmt'
213209
- 'Marwes/combine'
214210
- 'Geal/nom'
215211
- 'rust-lang/stdarch'
216212
- 'serde-rs/serde'
217-
# FIXME: chrono currently cannot be compiled with `--all-targets`
218-
# - 'chronotope/chrono'
213+
- 'chronotope/chrono'
219214
- 'hyperium/hyper'
220215
- 'rust-random/rand'
221216
- 'rust-lang/futures-rs'
222217
- 'rust-itertools/itertools'
223218
- 'rust-lang-nursery/failure'
224219
- 'rust-lang/log'
220+
- 'matthiaskrgr/clippy_ci_panic_test'
225221

226222
runs-on: ubuntu-latest
227223

@@ -237,12 +233,17 @@ jobs:
237233
- name: Install toolchain
238234
run: rustup show active-toolchain
239235

236+
- name: Set LD_LIBRARY_PATH
237+
run: |
238+
SYSROOT=$(rustc --print sysroot)
239+
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
240+
240241
# Download
241242
- name: Download target dir
242-
uses: actions/download-artifact@v1
243+
uses: actions/download-artifact@v3
243244
with:
244-
name: target
245-
path: target
245+
name: binaries
246+
path: target/debug
246247

247248
- name: Make Binaries Executable
248249
run: chmod +x $CARGO_TARGET_DIR/debug/*
@@ -251,7 +252,7 @@ jobs:
251252
- name: Test ${{ matrix.integration }}
252253
run: |
253254
RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | grep -o -E "nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}")" \
254-
$CARGO_TARGET_DIR/debug/integration
255+
$CARGO_TARGET_DIR/debug/integration --show-output
255256
env:
256257
INTEGRATION: ${{ matrix.integration }}
257258

Diff for: src/tools/clippy/CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -4680,6 +4680,7 @@ Released 2018-09-13
46804680

46814681
<!-- lint disable no-unused-definitions -->
46824682
<!-- begin autogenerated links to lint list -->
4683+
[`absolute_paths`]: https://rust-lang.github.io/rust-clippy/master/index.html#absolute_paths
46834684
[`absurd_extreme_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons
46844685
[`alloc_instead_of_core`]: https://rust-lang.github.io/rust-clippy/master/index.html#alloc_instead_of_core
46854686
[`allow_attributes`]: https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes
@@ -4819,6 +4820,7 @@ Released 2018-09-13
48194820
[`equatable_if_let`]: https://rust-lang.github.io/rust-clippy/master/index.html#equatable_if_let
48204821
[`erasing_op`]: https://rust-lang.github.io/rust-clippy/master/index.html#erasing_op
48214822
[`err_expect`]: https://rust-lang.github.io/rust-clippy/master/index.html#err_expect
4823+
[`error_impl_error`]: https://rust-lang.github.io/rust-clippy/master/index.html#error_impl_error
48224824
[`eval_order_dependence`]: https://rust-lang.github.io/rust-clippy/master/index.html#eval_order_dependence
48234825
[`excessive_nesting`]: https://rust-lang.github.io/rust-clippy/master/index.html#excessive_nesting
48244826
[`excessive_precision`]: https://rust-lang.github.io/rust-clippy/master/index.html#excessive_precision
@@ -4842,6 +4844,7 @@ Released 2018-09-13
48424844
[`field_reassign_with_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
48434845
[`filetype_is_file`]: https://rust-lang.github.io/rust-clippy/master/index.html#filetype_is_file
48444846
[`filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map
4847+
[`filter_map_bool_then`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_bool_then
48454848
[`filter_map_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_identity
48464849
[`filter_map_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_next
48474850
[`filter_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
@@ -4865,8 +4868,10 @@ Released 2018-09-13
48654868
[`forget_copy`]: https://rust-lang.github.io/rust-clippy/master/index.html#forget_copy
48664869
[`forget_non_drop`]: https://rust-lang.github.io/rust-clippy/master/index.html#forget_non_drop
48674870
[`forget_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#forget_ref
4871+
[`format_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#format_collect
48684872
[`format_in_format_args`]: https://rust-lang.github.io/rust-clippy/master/index.html#format_in_format_args
48694873
[`format_push_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string
4874+
[`four_forward_slashes`]: https://rust-lang.github.io/rust-clippy/master/index.html#four_forward_slashes
48704875
[`from_iter_instead_of_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#from_iter_instead_of_collect
48714876
[`from_over_into`]: https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
48724877
[`from_raw_with_void_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#from_raw_with_void_ptr
@@ -4937,6 +4942,7 @@ Released 2018-09-13
49374942
[`iter_on_single_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_on_single_items
49384943
[`iter_overeager_cloned`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_overeager_cloned
49394944
[`iter_skip_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_next
4945+
[`iter_skip_zero`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_zero
49404946
[`iter_with_drain`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_with_drain
49414947
[`iterator_step_by_zero`]: https://rust-lang.github.io/rust-clippy/master/index.html#iterator_step_by_zero
49424948
[`just_underscores_and_digits`]: https://rust-lang.github.io/rust-clippy/master/index.html#just_underscores_and_digits
@@ -5092,6 +5098,7 @@ Released 2018-09-13
50925098
[`needless_raw_string_hashes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
50935099
[`needless_raw_strings`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_strings
50945100
[`needless_return`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
5101+
[`needless_return_with_question_mark`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return_with_question_mark
50955102
[`needless_splitn`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_splitn
50965103
[`needless_update`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_update
50975104
[`neg_cmp_op_on_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#neg_cmp_op_on_partial_ord
@@ -5174,6 +5181,7 @@ Released 2018-09-13
51745181
[`rc_mutex`]: https://rust-lang.github.io/rust-clippy/master/index.html#rc_mutex
51755182
[`read_line_without_trim`]: https://rust-lang.github.io/rust-clippy/master/index.html#read_line_without_trim
51765183
[`read_zero_byte_vec`]: https://rust-lang.github.io/rust-clippy/master/index.html#read_zero_byte_vec
5184+
[`readonly_write_lock`]: https://rust-lang.github.io/rust-clippy/master/index.html#readonly_write_lock
51775185
[`recursive_format_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#recursive_format_impl
51785186
[`redundant_allocation`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_allocation
51795187
[`redundant_async_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_async_block
@@ -5185,6 +5193,8 @@ Released 2018-09-13
51855193
[`redundant_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else
51865194
[`redundant_feature_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_feature_names
51875195
[`redundant_field_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
5196+
[`redundant_guards`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards
5197+
[`redundant_locals`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals
51885198
[`redundant_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern
51895199
[`redundant_pattern_matching`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
51905200
[`redundant_pub_crate`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate
@@ -5254,6 +5264,7 @@ Released 2018-09-13
52545264
[`string_extend_chars`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_extend_chars
52555265
[`string_from_utf8_as_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_from_utf8_as_bytes
52565266
[`string_lit_as_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_lit_as_bytes
5267+
[`string_lit_chars_any`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_lit_chars_any
52575268
[`string_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_slice
52585269
[`string_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_to_string
52595270
[`strlen_on_c_strings`]: https://rust-lang.github.io/rust-clippy/master/index.html#strlen_on_c_strings
@@ -5362,6 +5373,7 @@ Released 2018-09-13
53625373
[`unused_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
53635374
[`unusual_byte_groupings`]: https://rust-lang.github.io/rust-clippy/master/index.html#unusual_byte_groupings
53645375
[`unwrap_in_result`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_in_result
5376+
[`unwrap_or_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
53655377
[`unwrap_or_else_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_else_default
53665378
[`unwrap_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
53675379
[`upper_case_acronyms`]: https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
@@ -5462,4 +5474,6 @@ Released 2018-09-13
54625474
[`accept-comment-above-statement`]: https://doc.rust-lang.org/clippy/lint_configuration.html#accept-comment-above-statement
54635475
[`accept-comment-above-attributes`]: https://doc.rust-lang.org/clippy/lint_configuration.html#accept-comment-above-attributes
54645476
[`allow-one-hash-in-raw-strings`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-one-hash-in-raw-strings
5477+
[`absolute-paths-max-segments`]: https://doc.rust-lang.org/clippy/lint_configuration.html#absolute-paths-max-segments
5478+
[`absolute-paths-allowed-crates`]: https://doc.rust-lang.org/clippy/lint_configuration.html#absolute-paths-allowed-crates
54655479
<!-- end autogenerated links to configuration documentation -->

Diff for: src/tools/clippy/book/src/lint_configuration.md

+21
Original file line numberDiff line numberDiff line change
@@ -730,3 +730,24 @@ Whether to allow `r#""#` when `r""` can be used
730730
* [`unnecessary_raw_string_hashes`](https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_raw_string_hashes)
731731

732732

733+
## `absolute-paths-max-segments`
734+
The maximum number of segments a path can have before being linted, anything above this will
735+
be linted.
736+
737+
**Default Value:** `2` (`u64`)
738+
739+
---
740+
**Affected lints:**
741+
* [`absolute_paths`](https://rust-lang.github.io/rust-clippy/master/index.html#absolute_paths)
742+
743+
744+
## `absolute-paths-allowed-crates`
745+
Which crates to allow absolute paths from
746+
747+
**Default Value:** `{}` (`rustc_data_structures::fx::FxHashSet<String>`)
748+
749+
---
750+
**Affected lints:**
751+
* [`absolute_paths`](https://rust-lang.github.io/rust-clippy/master/index.html#absolute_paths)
752+
753+

Diff for: src/tools/clippy/clippy_dev/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn clippy_project_root() -> PathBuf {
5151
for path in current_dir.ancestors() {
5252
let result = std::fs::read_to_string(path.join("Cargo.toml"));
5353
if let Err(err) = &result {
54-
if err.kind() == std::io::ErrorKind::NotFound {
54+
if err.kind() == io::ErrorKind::NotFound {
5555
continue;
5656
}
5757
}

Diff for: src/tools/clippy/clippy_dev/src/new_lint.rs

+5-13
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ fn create_test(lint: &LintData<'_>) -> io::Result<()> {
9696

9797
path.push("src");
9898
fs::create_dir(&path)?;
99-
let header = format!("//@compile-flags: --crate-name={lint_name}");
100-
write_file(path.join("main.rs"), get_test_file_contents(lint_name, Some(&header)))?;
99+
write_file(path.join("main.rs"), get_test_file_contents(lint_name))?;
101100

102101
Ok(())
103102
}
@@ -113,7 +112,7 @@ fn create_test(lint: &LintData<'_>) -> io::Result<()> {
113112
println!("Generated test directories: `{relative_test_dir}/pass`, `{relative_test_dir}/fail`");
114113
} else {
115114
let test_path = format!("tests/ui/{}.rs", lint.name);
116-
let test_contents = get_test_file_contents(lint.name, None);
115+
let test_contents = get_test_file_contents(lint.name);
117116
write_file(lint.project_root.join(&test_path), test_contents)?;
118117

119118
println!("Generated test file: `{test_path}`");
@@ -195,23 +194,16 @@ pub(crate) fn get_stabilization_version() -> String {
195194
parse_manifest(&contents).expect("Unable to find package version in `Cargo.toml`")
196195
}
197196

198-
fn get_test_file_contents(lint_name: &str, header_commands: Option<&str>) -> String {
199-
let mut contents = formatdoc!(
197+
fn get_test_file_contents(lint_name: &str) -> String {
198+
formatdoc!(
200199
r#"
201-
#![allow(unused)]
202200
#![warn(clippy::{lint_name})]
203201
204202
fn main() {{
205203
// test code goes here
206204
}}
207205
"#
208-
);
209-
210-
if let Some(header) = header_commands {
211-
contents = format!("{header}\n{contents}");
212-
}
213-
214-
contents
206+
)
215207
}
216208

217209
fn get_manifest_contents(lint_name: &str, hint: &str) -> String {

Diff for: src/tools/clippy/clippy_lints/src/absolute_paths.rs

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
use clippy_utils::diagnostics::span_lint;
2+
use clippy_utils::source::snippet_opt;
3+
use rustc_data_structures::fx::FxHashSet;
4+
use rustc_hir::def::{DefKind, Res};
5+
use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX};
6+
use rustc_hir::{HirId, ItemKind, Node, Path};
7+
use rustc_lint::{LateContext, LateLintPass};
8+
use rustc_session::{declare_tool_lint, impl_lint_pass};
9+
use rustc_span::symbol::kw;
10+
11+
declare_clippy_lint! {
12+
/// ### What it does
13+
/// Checks for usage of items through absolute paths, like `std::env::current_dir`.
14+
///
15+
/// ### Why is this bad?
16+
/// Many codebases have their own style when it comes to importing, but one that is seldom used
17+
/// is using absolute paths *everywhere*. This is generally considered unidiomatic, and you
18+
/// should add a `use` statement.
19+
///
20+
/// The default maximum segments (2) is pretty strict, you may want to increase this in
21+
/// `clippy.toml`.
22+
///
23+
/// Note: One exception to this is code from macro expansion - this does not lint such cases, as
24+
/// using absolute paths is the proper way of referencing items in one.
25+
///
26+
/// ### Example
27+
/// ```rust
28+
/// let x = std::f64::consts::PI;
29+
/// ```
30+
/// Use any of the below instead, or anything else:
31+
/// ```rust
32+
/// use std::f64;
33+
/// use std::f64::consts;
34+
/// use std::f64::consts::PI;
35+
/// let x = f64::consts::PI;
36+
/// let x = consts::PI;
37+
/// let x = PI;
38+
/// use std::f64::consts as f64_consts;
39+
/// let x = f64_consts::PI;
40+
/// ```
41+
#[clippy::version = "1.73.0"]
42+
pub ABSOLUTE_PATHS,
43+
restriction,
44+
"checks for usage of an item without a `use` statement"
45+
}
46+
impl_lint_pass!(AbsolutePaths => [ABSOLUTE_PATHS]);
47+
48+
pub struct AbsolutePaths {
49+
pub absolute_paths_max_segments: u64,
50+
pub absolute_paths_allowed_crates: FxHashSet<String>,
51+
}
52+
53+
impl LateLintPass<'_> for AbsolutePaths {
54+
// We should only lint `QPath::Resolved`s, but since `Path` is only used in `Resolved` and `UsePath`
55+
// we don't need to use a visitor or anything as we can just check if the `Node` for `hir_id` isn't
56+
// a `Use`
57+
#[expect(clippy::cast_possible_truncation)]
58+
fn check_path(&mut self, cx: &LateContext<'_>, path: &Path<'_>, hir_id: HirId) {
59+
let Self {
60+
absolute_paths_max_segments,
61+
absolute_paths_allowed_crates,
62+
} = self;
63+
64+
if !path.span.from_expansion()
65+
&& let Some(node) = cx.tcx.hir().find(hir_id)
66+
&& !matches!(node, Node::Item(item) if matches!(item.kind, ItemKind::Use(_, _)))
67+
&& let [first, rest @ ..] = path.segments
68+
// Handle `::std`
69+
&& let (segment, len) = if first.ident.name == kw::PathRoot {
70+
// Indexing is fine as `PathRoot` must be followed by another segment. `len() - 1`
71+
// is fine here for the same reason
72+
(&rest[0], path.segments.len() - 1)
73+
} else {
74+
(first, path.segments.len())
75+
}
76+
&& len > *absolute_paths_max_segments as usize
77+
&& let Some(segment_snippet) = snippet_opt(cx, segment.ident.span)
78+
&& segment_snippet == segment.ident.as_str()
79+
{
80+
let is_abs_external =
81+
matches!(segment.res, Res::Def(DefKind::Mod, DefId { index, .. }) if index == CRATE_DEF_INDEX);
82+
let is_abs_crate = segment.ident.name == kw::Crate;
83+
84+
if is_abs_external && absolute_paths_allowed_crates.contains(segment.ident.name.as_str())
85+
|| is_abs_crate && absolute_paths_allowed_crates.contains("crate")
86+
{
87+
return;
88+
}
89+
90+
if is_abs_external || is_abs_crate {
91+
span_lint(
92+
cx,
93+
ABSOLUTE_PATHS,
94+
path.span,
95+
"consider bringing this path into scope with the `use` keyword",
96+
);
97+
}
98+
}
99+
}
100+
}

Diff for: src/tools/clippy/clippy_lints/src/arc_with_non_send_sync.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
2-
use clippy_utils::last_path_segment;
32
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item};
3+
use clippy_utils::{is_from_proc_macro, last_path_segment};
44
use rustc_hir::{Expr, ExprKind};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_middle::ty;
@@ -38,10 +38,11 @@ declare_clippy_lint! {
3838
}
3939
declare_lint_pass!(ArcWithNonSendSync => [ARC_WITH_NON_SEND_SYNC]);
4040

41-
impl LateLintPass<'_> for ArcWithNonSendSync {
42-
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
43-
let ty = cx.typeck_results().expr_ty(expr);
44-
if is_type_diagnostic_item(cx, ty, sym::Arc)
41+
impl<'tcx> LateLintPass<'tcx> for ArcWithNonSendSync {
42+
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
43+
if !expr.span.from_expansion()
44+
&& let ty = cx.typeck_results().expr_ty(expr)
45+
&& is_type_diagnostic_item(cx, ty, sym::Arc)
4546
&& let ExprKind::Call(func, [arg]) = expr.kind
4647
&& let ExprKind::Path(func_path) = func.kind
4748
&& last_path_segment(&func_path).ident.name == sym::new
@@ -54,6 +55,7 @@ impl LateLintPass<'_> for ArcWithNonSendSync {
5455
&& let Some(sync) = cx.tcx.lang_items().sync_trait()
5556
&& let [is_send, is_sync] = [send, sync].map(|id| implements_trait(cx, arg_ty, id, &[]))
5657
&& !(is_send && is_sync)
58+
&& !is_from_proc_macro(cx, expr)
5759
{
5860
span_lint_and_then(
5961
cx,

Diff for: src/tools/clippy/clippy_lints/src/casts/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ declare_clippy_lint! {
181181
/// ### Why is this bad?
182182
/// It's just unnecessary.
183183
///
184+
/// ### Known problems
185+
/// When the expression on the left is a function call, the lint considers the return type to be
186+
/// a type alias if it's aliased through a `use` statement
187+
/// (like `use std::io::Result as IoResult`). It will not lint such cases.
188+
///
189+
/// This check is also rather primitive. It will only work on primitive types without any
190+
/// intermediate references, raw pointers and trait objects may or may not work.
191+
///
184192
/// ### Example
185193
/// ```rust
186194
/// let _ = 2i32 as i32;

0 commit comments

Comments
 (0)