Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit cb0a479

Browse files
committed
don't suggest to use std::vec::Vec for single_range_in_vec_init in a no_std environment
1 parent e146039 commit cb0a479

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/single_range_in_vec_init.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
2-
use clippy_utils::get_trait_def_id;
32
use clippy_utils::higher::VecArgs;
43
use clippy_utils::macros::root_macro_call_first_node;
54
use clippy_utils::source::SpanRangeExt;
65
use clippy_utils::ty::implements_trait;
6+
use clippy_utils::{get_trait_def_id, is_no_std_crate};
77
use rustc_ast::{LitIntType, LitKind, UintTy};
88
use rustc_errors::Applicability;
99
use rustc_hir::{Expr, ExprKind, LangItem, QPath, StructTailExpr};
@@ -125,7 +125,7 @@ impl LateLintPass<'_> for SingleRangeInVecInit {
125125
span,
126126
format!("{suggested_type} of `Range` that is only one element"),
127127
|diag| {
128-
if should_emit_every_value {
128+
if should_emit_every_value && !is_no_std_crate(cx) {
129129
diag.span_suggestion(
130130
span,
131131
"if you wanted a `Vec` that contains the entire range, try",

0 commit comments

Comments
 (0)