mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Auto merge of #12999 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
This commit is contained in:
commit
68a799aea9
@ -1943,7 +1943,7 @@ Released 2022-05-19
|
||||
[#8218](https://github.com/rust-lang/rust-clippy/pull/8218)
|
||||
* [`needless_match`]
|
||||
[#8471](https://github.com/rust-lang/rust-clippy/pull/8471)
|
||||
* [`allow_attributes_without_reason`] (Requires `#![feature(lint_reasons)]`)
|
||||
* [`allow_attributes_without_reason`]
|
||||
[#8504](https://github.com/rust-lang/rust-clippy/pull/8504)
|
||||
* [`print_in_format_impl`]
|
||||
[#8253](https://github.com/rust-lang/rust-clippy/pull/8253)
|
||||
|
@ -669,6 +669,8 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
|
||||
|
||||
---
|
||||
**Affected lints:**
|
||||
* [`allow_attributes`](https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes)
|
||||
* [`allow_attributes_without_reason`](https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes_without_reason)
|
||||
* [`almost_complete_range`](https://rust-lang.github.io/rust-clippy/master/index.html#almost_complete_range)
|
||||
* [`approx_constant`](https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant)
|
||||
* [`assigning_clones`](https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones)
|
||||
|
@ -266,7 +266,7 @@ define_Conf! {
|
||||
///
|
||||
/// Suppress lints whenever the suggested change would cause breakage for other crates.
|
||||
(avoid_breaking_exported_api: bool = true),
|
||||
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS, ASSIGNING_CLONES, LEGACY_NUMERIC_CONSTANTS, MANUAL_PATTERN_CHAR_COMPARISON.
|
||||
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS, ASSIGNING_CLONES, LEGACY_NUMERIC_CONSTANTS, MANUAL_PATTERN_CHAR_COMPARISON, ALLOW_ATTRIBUTES, ALLOW_ATTRIBUTES_WITHOUT_REASON.
|
||||
///
|
||||
/// The minimum rust version that the project supports. Defaults to the `rust-version` field in `Cargo.toml`
|
||||
#[default_text = ""]
|
||||
|
@ -17,6 +17,7 @@ macro_rules! msrv_aliases {
|
||||
|
||||
// names may refer to stabilized feature flags or library items
|
||||
msrv_aliases! {
|
||||
1,81,0 { LINT_REASONS_STABILIZATION }
|
||||
1,77,0 { C_STR_LITERALS }
|
||||
1,76,0 { PTR_FROM_REF, OPTION_RESULT_INSPECT }
|
||||
1,71,0 { TUPLE_ARRAY_CONVERSIONS, BUILD_HASHER_HASH_ONE }
|
||||
|
@ -1,73 +0,0 @@
|
||||
use ast::{AttrStyle, Attribute};
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::is_from_proc_macro;
|
||||
use rustc_ast as ast;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_session::declare_lint_pass;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for usage of the `#[allow]` attribute and suggests replacing it with
|
||||
/// `#[expect]`. (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
|
||||
///
|
||||
/// The expect attribute is still unstable and requires the `lint_reasons` feature
|
||||
/// on nightly. It can be enabled by adding `#![feature(lint_reasons)]` to
|
||||
/// the crate root.
|
||||
///
|
||||
/// This lint only warns on outer attributes (`#[allow]`), as inner attributes
|
||||
/// (`#![allow]`) are usually used to enable or disable lints on a global scale.
|
||||
///
|
||||
/// ### Why restrict this?
|
||||
/// The `#[allow]` attribute does not warn when the expected lint is no longer triggered,
|
||||
/// whereas `#[expect]` calls attention to this fact. This can be a useful reminder to
|
||||
/// remove attributes that are no longer needed.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```rust,ignore
|
||||
/// #[allow(unused_mut)]
|
||||
/// fn foo() -> usize {
|
||||
/// let mut a = Vec::new();
|
||||
/// a.len()
|
||||
/// }
|
||||
/// ```
|
||||
/// Use instead:
|
||||
/// ```rust,ignore
|
||||
/// #![feature(lint_reasons)]
|
||||
/// #[expect(unused_mut)]
|
||||
/// fn foo() -> usize {
|
||||
/// let mut a = Vec::new();
|
||||
/// a.len()
|
||||
/// }
|
||||
/// ```
|
||||
#[clippy::version = "1.70.0"]
|
||||
pub ALLOW_ATTRIBUTES,
|
||||
restriction,
|
||||
"`#[allow]` will not trigger if a warning isn't found. `#[expect]` triggers if there are no warnings."
|
||||
}
|
||||
|
||||
declare_lint_pass!(AllowAttribute => [ALLOW_ATTRIBUTES]);
|
||||
|
||||
impl LateLintPass<'_> for AllowAttribute {
|
||||
// Separate each crate's features.
|
||||
fn check_attribute<'cx>(&mut self, cx: &LateContext<'cx>, attr: &'cx Attribute) {
|
||||
if !in_external_macro(cx.sess(), attr.span)
|
||||
&& cx.tcx.features().lint_reasons
|
||||
&& let AttrStyle::Outer = attr.style
|
||||
&& let Some(ident) = attr.ident()
|
||||
&& ident.name == rustc_span::symbol::sym::allow
|
||||
&& !is_from_proc_macro(cx, attr)
|
||||
{
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
ALLOW_ATTRIBUTES,
|
||||
ident.span,
|
||||
"#[allow] attribute found",
|
||||
"replace it with",
|
||||
"expect".into(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
26
clippy_lints/src/attrs/allow_attributes.rs
Normal file
26
clippy_lints/src/attrs/allow_attributes.rs
Normal file
@ -0,0 +1,26 @@
|
||||
use super::ALLOW_ATTRIBUTES;
|
||||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::is_from_proc_macro;
|
||||
use rustc_ast::{AttrStyle, Attribute};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_lint::{LateContext, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
|
||||
// Separate each crate's features.
|
||||
pub fn check<'cx>(cx: &LateContext<'cx>, attr: &'cx Attribute) {
|
||||
if !in_external_macro(cx.sess(), attr.span)
|
||||
&& let AttrStyle::Outer = attr.style
|
||||
&& let Some(ident) = attr.ident()
|
||||
&& !is_from_proc_macro(cx, attr)
|
||||
{
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
ALLOW_ATTRIBUTES,
|
||||
ident.span,
|
||||
"#[allow] attribute found",
|
||||
"replace it with",
|
||||
"expect".into(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
}
|
@ -8,11 +8,6 @@ use rustc_span::sym;
|
||||
use rustc_span::symbol::Symbol;
|
||||
|
||||
pub(super) fn check<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[NestedMetaItem], attr: &'cx Attribute) {
|
||||
// Check for the feature
|
||||
if !cx.tcx.features().lint_reasons {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the reason is present
|
||||
if let Some(item) = items.last().and_then(NestedMetaItem::meta_item)
|
||||
&& let MetaItemKind::NameValue(_) = &item.kind
|
||||
|
@ -1,5 +1,6 @@
|
||||
//! checks for attributes
|
||||
|
||||
mod allow_attributes;
|
||||
mod allow_attributes_without_reason;
|
||||
mod blanket_clippy_restriction_lints;
|
||||
mod deprecated_cfg_attr;
|
||||
@ -14,11 +15,11 @@ mod unnecessary_clippy_cfg;
|
||||
mod useless_attribute;
|
||||
mod utils;
|
||||
|
||||
use clippy_config::msrvs::Msrv;
|
||||
use clippy_config::msrvs::{self, Msrv};
|
||||
use rustc_ast::{Attribute, MetaItemKind, NestedMetaItem};
|
||||
use rustc_hir::{ImplItem, Item, ItemKind, TraitItem};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass};
|
||||
use rustc_session::{declare_lint_pass, impl_lint_pass};
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_span::sym;
|
||||
use utils::{is_lint_level, is_relevant_impl, is_relevant_item, is_relevant_trait};
|
||||
|
||||
@ -270,26 +271,19 @@ declare_clippy_lint! {
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for attributes that allow lints without specifying the reason
|
||||
/// they should be allowed. (This requires the `lint_reasons` feature.)
|
||||
/// Checks for attributes that allow lints without a reason.
|
||||
///
|
||||
/// ### Why restrict this?
|
||||
/// There should always be a specific reason to allow a lint. This reason
|
||||
/// should be documented using the `reason` parameter, so that readers can
|
||||
/// understand why the `allow` is required, or remove it if it's no
|
||||
/// longer needed.
|
||||
/// Justifying each `allow` helps readers understand the reasoning,
|
||||
/// and may allow removing `allow` attributes if their purpose is obsolete.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
/// #![feature(lint_reasons)]
|
||||
///
|
||||
/// #![allow(clippy::some_lint)]
|
||||
/// ```
|
||||
///
|
||||
/// Use instead:
|
||||
/// ```no_run
|
||||
/// #![feature(lint_reasons)]
|
||||
///
|
||||
/// #![allow(clippy::some_lint, reason = "False positive rust-lang/rust-clippy#1002020")]
|
||||
/// ```
|
||||
#[clippy::version = "1.61.0"]
|
||||
@ -298,6 +292,41 @@ declare_clippy_lint! {
|
||||
"ensures that all `allow` and `expect` attributes have a reason"
|
||||
}
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for usage of the `#[allow]` attribute and suggests replacing it with
|
||||
/// the `#[expect]` (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
|
||||
///
|
||||
/// This lint only warns outer attributes (`#[allow]`), as inner attributes
|
||||
/// (`#![allow]`) are usually used to enable or disable lints on a global scale.
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// `#[expect]` attributes suppress the lint emission, but emit a warning, if
|
||||
/// the expectation is unfulfilled. This can be useful to be notified when the
|
||||
/// lint is no longer triggered.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```rust,ignore
|
||||
/// #[allow(unused_mut)]
|
||||
/// fn foo() -> usize {
|
||||
/// let mut a = Vec::new();
|
||||
/// a.len()
|
||||
/// }
|
||||
/// ```
|
||||
/// Use instead:
|
||||
/// ```rust,ignore
|
||||
/// #[expect(unused_mut)]
|
||||
/// fn foo() -> usize {
|
||||
/// let mut a = Vec::new();
|
||||
/// a.len()
|
||||
/// }
|
||||
/// ```
|
||||
#[clippy::version = "1.70.0"]
|
||||
pub ALLOW_ATTRIBUTES,
|
||||
restriction,
|
||||
"`#[allow]` will not trigger if a warning isn't found. `#[expect]` triggers if there are no warnings."
|
||||
}
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for `#[should_panic]` attributes without specifying the expected panic message.
|
||||
@ -470,7 +499,13 @@ declare_clippy_lint! {
|
||||
"duplicated attribute"
|
||||
}
|
||||
|
||||
declare_lint_pass!(Attributes => [
|
||||
#[derive(Clone)]
|
||||
pub struct Attributes {
|
||||
msrv: Msrv,
|
||||
}
|
||||
|
||||
impl_lint_pass!(Attributes => [
|
||||
ALLOW_ATTRIBUTES,
|
||||
ALLOW_ATTRIBUTES_WITHOUT_REASON,
|
||||
INLINE_ALWAYS,
|
||||
DEPRECATED_SEMVER,
|
||||
@ -481,6 +516,13 @@ declare_lint_pass!(Attributes => [
|
||||
DUPLICATED_ATTRIBUTES,
|
||||
]);
|
||||
|
||||
impl Attributes {
|
||||
#[must_use]
|
||||
pub fn new(msrv: Msrv) -> Self {
|
||||
Self { msrv }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for Attributes {
|
||||
fn check_crate(&mut self, cx: &LateContext<'tcx>) {
|
||||
blanket_clippy_restriction_lints::check_command_line(cx);
|
||||
@ -493,7 +535,11 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
|
||||
if is_lint_level(ident.name, attr.id) {
|
||||
blanket_clippy_restriction_lints::check(cx, ident.name, items);
|
||||
}
|
||||
if matches!(ident.name, sym::allow | sym::expect) {
|
||||
if matches!(ident.name, sym::allow) && self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION) {
|
||||
allow_attributes::check(cx, attr);
|
||||
}
|
||||
if matches!(ident.name, sym::allow | sym::expect) && self.msrv.meets(msrvs::LINT_REASONS_STABILIZATION)
|
||||
{
|
||||
allow_attributes_without_reason::check(cx, ident.name, items, attr);
|
||||
}
|
||||
if items.is_empty() || !attr.has_name(sym::deprecated) {
|
||||
@ -538,6 +584,8 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
|
||||
inline_always::check(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()));
|
||||
}
|
||||
}
|
||||
|
||||
extract_msrv_attr!(LateContext);
|
||||
}
|
||||
|
||||
pub struct EarlyAttributes {
|
||||
|
@ -61,7 +61,7 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
|
||||
)
|
||||
})
|
||||
.map_or(false, |assoc_item| {
|
||||
let proj = Ty::new_projection(cx.tcx, assoc_item.def_id, cx.tcx.mk_args_trait(ty, []));
|
||||
let proj = Ty::new_projection_from_args(cx.tcx, assoc_item.def_id, cx.tcx.mk_args_trait(ty, []));
|
||||
let nty = cx.tcx.normalize_erasing_regions(cx.param_env, proj);
|
||||
|
||||
nty.is_bool()
|
||||
|
@ -21,6 +21,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
|
||||
|
||||
fn is_known_nan(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
|
||||
match constant(cx, cx.typeck_results(), e) {
|
||||
// FIXME(f16_f128): add these types when nan checks are available on all platforms
|
||||
Some(Constant::F64(n)) => n.is_nan(),
|
||||
Some(Constant::F32(n)) => n.is_nan(),
|
||||
_ => false,
|
||||
|
@ -38,7 +38,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::unsorted_clippy_utils_paths::UNSORTED_CLIPPY_UTILS_PATHS_INFO,
|
||||
crate::absolute_paths::ABSOLUTE_PATHS_INFO,
|
||||
crate::allow_attributes::ALLOW_ATTRIBUTES_INFO,
|
||||
crate::almost_complete_range::ALMOST_COMPLETE_RANGE_INFO,
|
||||
crate::approx_const::APPROX_CONSTANT_INFO,
|
||||
crate::arc_with_non_send_sync::ARC_WITH_NON_SEND_SYNC_INFO,
|
||||
@ -49,6 +48,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
|
||||
crate::assertions_on_result_states::ASSERTIONS_ON_RESULT_STATES_INFO,
|
||||
crate::assigning_clones::ASSIGNING_CLONES_INFO,
|
||||
crate::async_yields_async::ASYNC_YIELDS_ASYNC_INFO,
|
||||
crate::attrs::ALLOW_ATTRIBUTES_INFO,
|
||||
crate::attrs::ALLOW_ATTRIBUTES_WITHOUT_REASON_INFO,
|
||||
crate::attrs::BLANKET_CLIPPY_RESTRICTION_LINTS_INFO,
|
||||
crate::attrs::DEPRECATED_CFG_ATTR_INFO,
|
||||
|
@ -6,7 +6,7 @@ use clippy_utils::{
|
||||
expr_use_ctxt, get_parent_expr, is_block_like, is_lint_allowed, path_to_local, DefinedTy, ExprUseNode,
|
||||
};
|
||||
use core::mem;
|
||||
use rustc_ast::util::parser::{PREC_POSTFIX, PREC_PREFIX};
|
||||
use rustc_ast::util::parser::{PREC_PREFIX, PREC_UNAMBIGUOUS};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::intravisit::{walk_ty, Visitor};
|
||||
@ -1007,7 +1007,7 @@ fn report<'tcx>(
|
||||
let (precedence, calls_field) = match cx.tcx.parent_hir_node(data.first_expr.hir_id) {
|
||||
Node::Expr(e) => match e.kind {
|
||||
ExprKind::Call(callee, _) if callee.hir_id != data.first_expr.hir_id => (0, false),
|
||||
ExprKind::Call(..) => (PREC_POSTFIX, matches!(expr.kind, ExprKind::Field(..))),
|
||||
ExprKind::Call(..) => (PREC_UNAMBIGUOUS, matches!(expr.kind, ExprKind::Field(..))),
|
||||
_ => (e.precedence().order(), false),
|
||||
},
|
||||
_ => (0, false),
|
||||
@ -1154,7 +1154,7 @@ impl<'tcx> Dereferencing<'tcx> {
|
||||
},
|
||||
Some(parent) if !parent.span.from_expansion() => {
|
||||
// Double reference might be needed at this point.
|
||||
if parent.precedence().order() == PREC_POSTFIX {
|
||||
if parent.precedence().order() == PREC_UNAMBIGUOUS {
|
||||
// Parentheses would be needed here, don't lint.
|
||||
*outer_pat = None;
|
||||
} else {
|
||||
|
@ -141,18 +141,17 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
|
||||
#[must_use]
|
||||
fn max_digits(fty: FloatTy) -> u32 {
|
||||
match fty {
|
||||
// FIXME(f16_f128): replace the magic numbers once `{f16,f128}::DIGITS` are available
|
||||
FloatTy::F16 => 3,
|
||||
FloatTy::F16 => f16::DIGITS,
|
||||
FloatTy::F32 => f32::DIGITS,
|
||||
FloatTy::F64 => f64::DIGITS,
|
||||
FloatTy::F128 => 33,
|
||||
FloatTy::F128 => f128::DIGITS,
|
||||
}
|
||||
}
|
||||
|
||||
/// Counts the digits excluding leading zeros
|
||||
#[must_use]
|
||||
fn count_digits(s: &str) -> usize {
|
||||
// Note that s does not contain the f32/64 suffix, and underscores have been stripped
|
||||
// Note that s does not contain the `f{16,32,64,128}` suffix, and underscores have been stripped
|
||||
s.chars()
|
||||
.filter(|c| *c != '-' && *c != '.')
|
||||
.take_while(|c| *c != 'e' && *c != 'E')
|
||||
|
@ -1,10 +1,11 @@
|
||||
#![feature(array_windows)]
|
||||
#![feature(binary_heap_into_iter_sorted)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(f128)]
|
||||
#![feature(f16)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(iter_intersperse)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(never_type)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(stmt_expr_attributes)]
|
||||
@ -71,7 +72,6 @@ mod renamed_lints;
|
||||
|
||||
// begin lints modules, do not remove this comment, it’s used in `update_lints`
|
||||
mod absolute_paths;
|
||||
mod allow_attributes;
|
||||
mod almost_complete_range;
|
||||
mod approx_const;
|
||||
mod arc_with_non_send_sync;
|
||||
@ -698,7 +698,7 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
|
||||
store.register_late_pass(|_| Box::new(mut_reference::UnnecessaryMutPassed));
|
||||
store.register_late_pass(|_| Box::<significant_drop_tightening::SignificantDropTightening<'_>>::default());
|
||||
store.register_late_pass(|_| Box::new(len_zero::LenZero));
|
||||
store.register_late_pass(|_| Box::new(attrs::Attributes));
|
||||
store.register_late_pass(move |_| Box::new(attrs::Attributes::new(msrv())));
|
||||
store.register_late_pass(|_| Box::new(blocks_in_conditions::BlocksInConditions));
|
||||
store.register_late_pass(|_| Box::new(unicode::Unicode));
|
||||
store.register_late_pass(|_| Box::new(uninit_vec::UninitVec));
|
||||
@ -1064,7 +1064,6 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
|
||||
store.register_late_pass(|_| Box::new(needless_maybe_sized::NeedlessMaybeSized));
|
||||
store.register_late_pass(|_| Box::new(redundant_async_block::RedundantAsyncBlock));
|
||||
store.register_late_pass(|_| Box::new(let_with_type_underscore::UnderscoreTyped));
|
||||
store.register_late_pass(|_| Box::new(allow_attributes::AllowAttribute));
|
||||
store.register_late_pass(move |_| Box::new(manual_main_separator_str::ManualMainSeparatorStr::new(msrv())));
|
||||
store.register_late_pass(|_| Box::new(unnecessary_struct_initialization::UnnecessaryStruct));
|
||||
store.register_late_pass(move |_| {
|
||||
|
@ -156,6 +156,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualFloatMethods {
|
||||
|
||||
fn is_infinity(constant: &Constant<'_>) -> bool {
|
||||
match constant {
|
||||
// FIXME(f16_f128): add f16 and f128 when constants are available
|
||||
Constant::F32(float) => *float == f32::INFINITY,
|
||||
Constant::F64(float) => *float == f64::INFINITY,
|
||||
_ => false,
|
||||
@ -164,6 +165,7 @@ fn is_infinity(constant: &Constant<'_>) -> bool {
|
||||
|
||||
fn is_neg_infinity(constant: &Constant<'_>) -> bool {
|
||||
match constant {
|
||||
// FIXME(f16_f128): add f16 and f128 when constants are available
|
||||
Constant::F32(float) => *float == f32::NEG_INFINITY,
|
||||
Constant::F64(float) => *float == f64::NEG_INFINITY,
|
||||
_ => false,
|
||||
|
@ -7,7 +7,7 @@ use clippy_utils::{
|
||||
can_move_expr_to_closure, is_else_clause, is_lint_allowed, is_res_lang_ctor, path_res, path_to_local_id,
|
||||
peel_blocks, peel_hir_expr_refs, peel_hir_expr_while, CaptureKind,
|
||||
};
|
||||
use rustc_ast::util::parser::PREC_POSTFIX;
|
||||
use rustc_ast::util::parser::PREC_UNAMBIGUOUS;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::LangItem::{OptionNone, OptionSome};
|
||||
@ -117,7 +117,7 @@ where
|
||||
// it's being passed by value.
|
||||
let scrutinee = peel_hir_expr_refs(scrutinee).0;
|
||||
let (scrutinee_str, _) = snippet_with_context(cx, scrutinee.span, expr_ctxt, "..", &mut app);
|
||||
let scrutinee_str = if scrutinee.span.eq_ctxt(expr.span) && scrutinee.precedence().order() < PREC_POSTFIX {
|
||||
let scrutinee_str = if scrutinee.span.eq_ctxt(expr.span) && scrutinee.precedence().order() < PREC_UNAMBIGUOUS {
|
||||
format!("({scrutinee_str})")
|
||||
} else {
|
||||
scrutinee_str.into()
|
||||
|
@ -206,7 +206,7 @@ fn iterates_same_ty<'tcx>(cx: &LateContext<'tcx>, iter_ty: Ty<'tcx>, collect_ty:
|
||||
&& let Some(into_iter_item_proj) = make_projection(cx.tcx, into_iter_trait, sym::Item, [collect_ty])
|
||||
&& let Ok(into_iter_item_ty) = cx.tcx.try_normalize_erasing_regions(
|
||||
cx.param_env,
|
||||
Ty::new_projection(cx.tcx, into_iter_item_proj.def_id, into_iter_item_proj.args),
|
||||
Ty::new_projection_from_args(cx.tcx, into_iter_item_proj.def_id, into_iter_item_proj.args),
|
||||
)
|
||||
{
|
||||
iter_item_ty == into_iter_item_ty
|
||||
@ -235,7 +235,7 @@ fn is_contains_sig(cx: &LateContext<'_>, call_id: HirId, iter_expr: &Expr<'_>) -
|
||||
iter_trait,
|
||||
)
|
||||
&& let args = cx.tcx.mk_args(&[GenericArg::from(typeck.expr_ty_adjusted(iter_expr))])
|
||||
&& let proj_ty = Ty::new_projection(cx.tcx, iter_item.def_id, args)
|
||||
&& let proj_ty = Ty::new_projection_from_args(cx.tcx, iter_item.def_id, args)
|
||||
&& let Ok(item_ty) = cx.tcx.try_normalize_erasing_regions(cx.param_env, proj_ty)
|
||||
{
|
||||
item_ty == EarlyBinder::bind(search_ty).instantiate(cx.tcx, cx.typeck_results().node_args(call_id))
|
||||
|
@ -269,7 +269,7 @@ fn needless_borrow_count<'tcx>(
|
||||
return false;
|
||||
}
|
||||
|
||||
let predicate = EarlyBinder::bind(predicate).instantiate(cx.tcx, &args_with_referent_ty);
|
||||
let predicate = EarlyBinder::bind(predicate).instantiate(cx.tcx, &args_with_referent_ty[..]);
|
||||
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), cx.param_env, predicate);
|
||||
let infcx = cx.tcx.infer_ctxt().build();
|
||||
infcx.predicate_must_hold_modulo_regions(&obligation)
|
||||
|
@ -73,7 +73,7 @@ fn type_param_bounds<'tcx>(generics: &'tcx Generics<'tcx>) -> impl Iterator<Item
|
||||
predicate_pos,
|
||||
bound_pos,
|
||||
}),
|
||||
GenericBound::Outlives(_) => None,
|
||||
GenericBound::Outlives(_) | GenericBound::Use(..) => None,
|
||||
})
|
||||
.filter(|bound| !bound.trait_bound.span.from_expansion()),
|
||||
)
|
||||
|
@ -86,6 +86,7 @@ fn get_lint_and_message(is_local: bool, is_comparing_arrays: bool) -> (&'static
|
||||
|
||||
fn is_allowed(val: &Constant<'_>) -> bool {
|
||||
match val {
|
||||
// FIXME(f16_f128): add when equality check is available on all platforms
|
||||
&Constant::F32(f) => f == 0.0 || f.is_infinite(),
|
||||
&Constant::F64(f) => f == 0.0 || f.is_infinite(),
|
||||
Constant::Vec(vec) => vec.iter().all(|f| match f {
|
||||
|
@ -79,6 +79,7 @@ fn analyze_operand(operand: &Expr<'_>, cx: &LateContext<'_>, expr: &Expr<'_>) ->
|
||||
},
|
||||
_ => {},
|
||||
},
|
||||
// FIXME(f16_f128): add when casting is available on all platforms
|
||||
Some(Constant::F32(f)) => {
|
||||
return Some(floating_point_operand_info(&f));
|
||||
},
|
||||
|
@ -133,7 +133,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantSlicing {
|
||||
} else if let Some(target_id) = cx.tcx.lang_items().deref_target() {
|
||||
if let Ok(deref_ty) = cx.tcx.try_normalize_erasing_regions(
|
||||
cx.param_env,
|
||||
Ty::new_projection(cx.tcx, target_id, cx.tcx.mk_args(&[GenericArg::from(indexed_ty)])),
|
||||
Ty::new_projection_from_args(cx.tcx, target_id, cx.tcx.mk_args(&[GenericArg::from(indexed_ty)])),
|
||||
) {
|
||||
if deref_ty == expr_ty {
|
||||
let snip = snippet_with_context(cx, indexed.span, ctxt, "..", &mut app).0;
|
||||
|
@ -38,6 +38,7 @@ impl<'tcx> LateLintPass<'tcx> for ZeroDiv {
|
||||
// do something like 0.0/(2.0 - 2.0), but it would be nice to warn on that case too.
|
||||
&& let Some(lhs_value) = constant_simple(cx, cx.typeck_results(), left)
|
||||
&& let Some(rhs_value) = constant_simple(cx, cx.typeck_results(), right)
|
||||
// FIXME(f16_f128): add these types when eq is available on all platforms
|
||||
&& (Constant::F32(0.0) == lhs_value || Constant::F64(0.0) == lhs_value)
|
||||
&& (Constant::F32(0.0) == rhs_value || Constant::F64(0.0) == rhs_value)
|
||||
{
|
||||
|
@ -9,6 +9,8 @@ clippy_config = { path = "../clippy_config" }
|
||||
arrayvec = { version = "0.7", default-features = false }
|
||||
itertools = "0.12"
|
||||
rustc-semver = "1.1"
|
||||
# FIXME(f16_f128): remove when no longer needed for parsing
|
||||
rustc_apfloat = "0.2.0"
|
||||
|
||||
[features]
|
||||
deny-warnings = ["clippy_config/deny-warnings"]
|
||||
|
@ -449,13 +449,13 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
|
||||
use ForeignItemKind::*;
|
||||
match (l, r) {
|
||||
(
|
||||
Static(box StaticForeignItem {
|
||||
Static(box StaticItem {
|
||||
ty: lt,
|
||||
mutability: lm,
|
||||
expr: le,
|
||||
safety: ls,
|
||||
}),
|
||||
Static(box StaticForeignItem {
|
||||
Static(box StaticItem {
|
||||
ty: rt,
|
||||
mutability: rm,
|
||||
expr: re,
|
||||
@ -724,12 +724,7 @@ pub fn eq_ty(l: &Ty, r: &Ty) -> bool {
|
||||
(Tup(l), Tup(r)) => over(l, r, |l, r| eq_ty(l, r)),
|
||||
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, eq_qself) && eq_path(lp, rp),
|
||||
(TraitObject(lg, ls), TraitObject(rg, rs)) => ls == rs && over(lg, rg, eq_generic_bound),
|
||||
(ImplTrait(_, lg, lc), ImplTrait(_, rg, rc)) => {
|
||||
over(lg, rg, eq_generic_bound)
|
||||
&& both(lc, rc, |lc, rc| {
|
||||
over(lc.0.as_slice(), rc.0.as_slice(), eq_precise_capture)
|
||||
})
|
||||
},
|
||||
(ImplTrait(_, lg), ImplTrait(_, rg)) => over(lg, rg, eq_generic_bound),
|
||||
(Typeof(l), Typeof(r)) => eq_expr(&l.value, &r.value),
|
||||
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
|
||||
_ => false,
|
||||
|
@ -4,6 +4,8 @@ use crate::macros::HirNode;
|
||||
use crate::source::{walk_span_to_context, SpanRangeExt};
|
||||
use crate::{clip, is_direct_expn_of, sext, unsext};
|
||||
|
||||
use rustc_apfloat::ieee::{Half, Quad};
|
||||
use rustc_apfloat::Float;
|
||||
use rustc_ast::ast::{self, LitFloatType, LitKind};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
@ -15,8 +17,8 @@ use rustc_middle::mir::ConstValue;
|
||||
use rustc_middle::ty::{self, EarlyBinder, FloatTy, GenericArgsRef, IntTy, List, ScalarInt, Ty, TyCtxt, UintTy};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::sym;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::{sym, SyntaxContext};
|
||||
use rustc_target::abi::Size;
|
||||
use std::cmp::Ordering;
|
||||
use std::hash::{Hash, Hasher};
|
||||
@ -34,10 +36,14 @@ pub enum Constant<'tcx> {
|
||||
Char(char),
|
||||
/// An integer's bit representation.
|
||||
Int(u128),
|
||||
/// An `f16`.
|
||||
F16(f16),
|
||||
/// An `f32`.
|
||||
F32(f32),
|
||||
/// An `f64`.
|
||||
F64(f64),
|
||||
/// An `f128`.
|
||||
F128(f128),
|
||||
/// `true` or `false`.
|
||||
Bool(bool),
|
||||
/// An array of constants.
|
||||
@ -162,12 +168,19 @@ impl<'tcx> Hash for Constant<'tcx> {
|
||||
Self::Int(i) => {
|
||||
i.hash(state);
|
||||
},
|
||||
Self::F16(f) => {
|
||||
// FIXME(f16_f128): once conversions to/from `f128` are available on all platforms,
|
||||
f.to_bits().hash(state);
|
||||
},
|
||||
Self::F32(f) => {
|
||||
f64::from(f).to_bits().hash(state);
|
||||
},
|
||||
Self::F64(f) => {
|
||||
f.to_bits().hash(state);
|
||||
},
|
||||
Self::F128(f) => {
|
||||
f.to_bits().hash(state);
|
||||
},
|
||||
Self::Bool(b) => {
|
||||
b.hash(state);
|
||||
},
|
||||
@ -269,6 +282,16 @@ impl<'tcx> Constant<'tcx> {
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
fn parse_f16(s: &str) -> Self {
|
||||
let f: Half = s.parse().unwrap();
|
||||
Self::F16(f16::from_bits(f.to_bits().try_into().unwrap()))
|
||||
}
|
||||
|
||||
fn parse_f128(s: &str) -> Self {
|
||||
let f: Quad = s.parse().unwrap();
|
||||
Self::F128(f128::from_bits(f.to_bits()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses a `LitKind` to a `Constant`.
|
||||
@ -280,16 +303,17 @@ pub fn lit_to_mir_constant<'tcx>(lit: &LitKind, ty: Option<Ty<'tcx>>) -> Constan
|
||||
LitKind::Char(c) => Constant::Char(c),
|
||||
LitKind::Int(n, _) => Constant::Int(n.get()),
|
||||
LitKind::Float(ref is, LitFloatType::Suffixed(fty)) => match fty {
|
||||
ast::FloatTy::F16 => unimplemented!("f16_f128"),
|
||||
// FIXME(f16_f128): just use `parse()` directly when available for `f16`/`f128`
|
||||
ast::FloatTy::F16 => Constant::parse_f16(is.as_str()),
|
||||
ast::FloatTy::F32 => Constant::F32(is.as_str().parse().unwrap()),
|
||||
ast::FloatTy::F64 => Constant::F64(is.as_str().parse().unwrap()),
|
||||
ast::FloatTy::F128 => unimplemented!("f16_f128"),
|
||||
ast::FloatTy::F128 => Constant::parse_f128(is.as_str()),
|
||||
},
|
||||
LitKind::Float(ref is, LitFloatType::Unsuffixed) => match ty.expect("type of float is known").kind() {
|
||||
ty::Float(FloatTy::F16) => unimplemented!("f16_f128"),
|
||||
ty::Float(FloatTy::F16) => Constant::parse_f16(is.as_str()),
|
||||
ty::Float(FloatTy::F32) => Constant::F32(is.as_str().parse().unwrap()),
|
||||
ty::Float(FloatTy::F64) => Constant::F64(is.as_str().parse().unwrap()),
|
||||
ty::Float(FloatTy::F128) => unimplemented!("f16_f128"),
|
||||
ty::Float(FloatTy::F128) => Constant::parse_f128(is.as_str()),
|
||||
_ => bug!(),
|
||||
},
|
||||
LitKind::Bool(b) => Constant::Bool(b),
|
||||
@ -638,15 +662,19 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
|
||||
|
||||
match (lhs, index) {
|
||||
(Some(Constant::Vec(vec)), Some(Constant::Int(index))) => match vec.get(index as usize) {
|
||||
Some(Constant::F16(x)) => Some(Constant::F16(*x)),
|
||||
Some(Constant::F32(x)) => Some(Constant::F32(*x)),
|
||||
Some(Constant::F64(x)) => Some(Constant::F64(*x)),
|
||||
Some(Constant::F128(x)) => Some(Constant::F128(*x)),
|
||||
_ => None,
|
||||
},
|
||||
(Some(Constant::Vec(vec)), _) => {
|
||||
if !vec.is_empty() && vec.iter().all(|x| *x == vec[0]) {
|
||||
match vec.first() {
|
||||
Some(Constant::F16(x)) => Some(Constant::F16(*x)),
|
||||
Some(Constant::F32(x)) => Some(Constant::F32(*x)),
|
||||
Some(Constant::F64(x)) => Some(Constant::F64(*x)),
|
||||
Some(Constant::F128(x)) => Some(Constant::F128(*x)),
|
||||
_ => None,
|
||||
}
|
||||
} else {
|
||||
@ -664,7 +692,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
|
||||
{
|
||||
// Try to detect any `cfg`ed statements or empty macro expansions.
|
||||
let span = block.span.data();
|
||||
if span.ctxt.is_root() {
|
||||
if span.ctxt == SyntaxContext::root() {
|
||||
if let Some(expr_span) = walk_span_to_context(expr.span, span.ctxt)
|
||||
&& let expr_lo = expr_span.lo()
|
||||
&& expr_lo >= span.lo
|
||||
@ -773,6 +801,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
|
||||
},
|
||||
_ => None,
|
||||
},
|
||||
// FIXME(f16_f128): add these types when binary operations are available on all platforms
|
||||
(Constant::F32(l), Some(Constant::F32(r))) => match op.node {
|
||||
BinOpKind::Add => Some(Constant::F32(l + r)),
|
||||
BinOpKind::Sub => Some(Constant::F32(l - r)),
|
||||
@ -826,8 +855,10 @@ pub fn mir_to_const<'tcx>(lcx: &LateContext<'tcx>, result: mir::Const<'tcx>) ->
|
||||
ty::Adt(adt_def, _) if adt_def.is_struct() => Some(Constant::Adt(result)),
|
||||
ty::Bool => Some(Constant::Bool(int == ScalarInt::TRUE)),
|
||||
ty::Uint(_) | ty::Int(_) => Some(Constant::Int(int.to_bits(int.size()))),
|
||||
ty::Float(FloatTy::F16) => Some(Constant::F16(f16::from_bits(int.into()))),
|
||||
ty::Float(FloatTy::F32) => Some(Constant::F32(f32::from_bits(int.into()))),
|
||||
ty::Float(FloatTy::F64) => Some(Constant::F64(f64::from_bits(int.into()))),
|
||||
ty::Float(FloatTy::F128) => Some(Constant::F128(f128::from_bits(int.into()))),
|
||||
ty::RawPtr(_, _) => Some(Constant::RawPtr(int.to_bits(int.size()))),
|
||||
_ => None,
|
||||
},
|
||||
@ -848,10 +879,10 @@ pub fn mir_to_const<'tcx>(lcx: &LateContext<'tcx>, result: mir::Const<'tcx>) ->
|
||||
let range = alloc_range(offset + size * idx, size);
|
||||
let val = alloc.read_scalar(&lcx.tcx, range, /* read_provenance */ false).ok()?;
|
||||
res.push(match flt {
|
||||
FloatTy::F16 => unimplemented!("f16_f128"),
|
||||
FloatTy::F16 => Constant::F16(f16::from_bits(val.to_u16().ok()?)),
|
||||
FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().ok()?)),
|
||||
FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().ok()?)),
|
||||
FloatTy::F128 => unimplemented!("f16_f128"),
|
||||
FloatTy::F128 => Constant::F128(f128::from_bits(val.to_u128().ok()?)),
|
||||
});
|
||||
}
|
||||
Some(Constant::Vec(res))
|
||||
|
@ -1,10 +1,10 @@
|
||||
#![feature(array_chunks)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(control_flow_enum)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
#![feature(f128)]
|
||||
#![feature(f16)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(never_type)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(assert_matches)]
|
||||
@ -2881,6 +2881,7 @@ pub fn expr_use_ctxt<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) -> ExprU
|
||||
moved_before_use,
|
||||
same_ctxt,
|
||||
},
|
||||
Some(ControlFlow::Break(_)) => unreachable!("type of node is ControlFlow<!>"),
|
||||
None => ExprUseCtxt {
|
||||
node: Node::Crate(cx.tcx.hir().root_module()),
|
||||
child_id: HirId::INVALID,
|
||||
|
@ -292,7 +292,7 @@ pub fn implements_trait_with_env_from_iter<'tcx>(
|
||||
let trait_ref = TraitRef::new(
|
||||
tcx,
|
||||
trait_id,
|
||||
Some(GenericArg::from(ty)).into_iter().chain(args).chain(effect_arg),
|
||||
[GenericArg::from(ty)].into_iter().chain(args).chain(effect_arg),
|
||||
);
|
||||
|
||||
debug_assert_matches!(
|
||||
@ -1126,7 +1126,7 @@ pub fn make_projection<'tcx>(
|
||||
#[cfg(debug_assertions)]
|
||||
assert_generic_args_match(tcx, assoc_item.def_id, args);
|
||||
|
||||
Some(AliasTy::new(tcx, assoc_item.def_id, args))
|
||||
Some(AliasTy::new_from_args(tcx, assoc_item.def_id, args))
|
||||
}
|
||||
helper(
|
||||
tcx,
|
||||
@ -1165,7 +1165,7 @@ pub fn make_normalized_projection<'tcx>(
|
||||
);
|
||||
return None;
|
||||
}
|
||||
match tcx.try_normalize_erasing_regions(param_env, Ty::new_projection(tcx, ty.def_id, ty.args)) {
|
||||
match tcx.try_normalize_erasing_regions(param_env, Ty::new_projection_from_args(tcx, ty.def_id, ty.args)) {
|
||||
Ok(ty) => Some(ty),
|
||||
Err(e) => {
|
||||
debug_assert!(false, "failed to normalize type `{ty}`: {e:#?}");
|
||||
@ -1289,7 +1289,7 @@ pub fn make_normalized_projection_with_regions<'tcx>(
|
||||
.infer_ctxt()
|
||||
.build()
|
||||
.at(&cause, param_env)
|
||||
.query_normalize(Ty::new_projection(tcx, ty.def_id, ty.args))
|
||||
.query_normalize(Ty::new_projection_from_args(tcx, ty.def_id, ty.args))
|
||||
{
|
||||
Ok(ty) => Some(ty.value),
|
||||
Err(e) => {
|
||||
|
@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2024-06-13"
|
||||
channel = "nightly-2024-06-27"
|
||||
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
|
||||
|
@ -2,7 +2,6 @@
|
||||
#![allow(rustc::untranslatable_diagnostic)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lint_reasons)]
|
||||
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
|
||||
// warn on lints, that are included in `rust-lang/rust`s bootstrap
|
||||
#![warn(rust_2018_idioms, unused_lifetimes)]
|
||||
@ -180,12 +179,12 @@ pub fn main() {
|
||||
|
||||
rustc_driver::init_rustc_env_logger(&early_dcx);
|
||||
|
||||
let using_internal_features = rustc_driver::install_ice_hook(BUG_REPORT_URL, |handler| {
|
||||
let using_internal_features = rustc_driver::install_ice_hook(BUG_REPORT_URL, |dcx| {
|
||||
// FIXME: this macro calls unwrap internally but is called in a panicking context! It's not
|
||||
// as simple as moving the call from the hook to main, because `install_ice_hook` doesn't
|
||||
// accept a generic closure.
|
||||
let version_info = rustc_tools_util::get_version_info!();
|
||||
handler.note(format!("Clippy version: {version_info}"));
|
||||
dcx.handle().note(format!("Clippy version: {version_info}"));
|
||||
});
|
||||
|
||||
exit(rustc_driver::catch_with_exit_code(move || {
|
||||
|
@ -1,10 +1,10 @@
|
||||
error: file is loaded as a module multiple times: `src/b.rs`
|
||||
--> src/main.rs:5:1
|
||||
--> src/main.rs:3:1
|
||||
|
|
||||
5 | mod b;
|
||||
3 | mod b;
|
||||
| ^^^^^^ first loaded here
|
||||
6 | / #[path = "b.rs"]
|
||||
7 | | mod b2;
|
||||
4 | / #[path = "b.rs"]
|
||||
5 | | mod b2;
|
||||
| |_______^ loaded again here
|
||||
|
|
||||
= help: replace all but one `mod` item with `use` items
|
||||
@ -12,34 +12,34 @@ error: file is loaded as a module multiple times: `src/b.rs`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::duplicate_mod)]`
|
||||
|
||||
error: file is loaded as a module multiple times: `src/c.rs`
|
||||
--> src/main.rs:9:1
|
||||
--> src/main.rs:7:1
|
||||
|
|
||||
9 | mod c;
|
||||
7 | mod c;
|
||||
| ^^^^^^ first loaded here
|
||||
10 | / #[path = "c.rs"]
|
||||
11 | | mod c2;
|
||||
8 | / #[path = "c.rs"]
|
||||
9 | | mod c2;
|
||||
| |_______^ loaded again here
|
||||
12 | / #[path = "c.rs"]
|
||||
13 | | mod c3;
|
||||
10 | / #[path = "c.rs"]
|
||||
11 | | mod c3;
|
||||
| |_______^ loaded again here
|
||||
|
|
||||
= help: replace all but one `mod` item with `use` items
|
||||
|
||||
error: file is loaded as a module multiple times: `src/d.rs`
|
||||
--> src/main.rs:18:1
|
||||
--> src/main.rs:16:1
|
||||
|
|
||||
18 | mod d;
|
||||
16 | mod d;
|
||||
| ^^^^^^ first loaded here
|
||||
19 | / #[path = "d.rs"]
|
||||
20 | | mod d2;
|
||||
17 | / #[path = "d.rs"]
|
||||
18 | | mod d2;
|
||||
| |_______^ loaded again here
|
||||
|
|
||||
= help: replace all but one `mod` item with `use` items
|
||||
|
||||
error: file is loaded as a module multiple times: `src/from_other_module.rs`
|
||||
--> src/main.rs:15:1
|
||||
--> src/main.rs:13:1
|
||||
|
|
||||
15 | mod from_other_module;
|
||||
13 | mod from_other_module;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ first loaded here
|
||||
|
|
||||
::: src/other_module/mod.rs:1:1
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
mod a;
|
||||
|
||||
mod b;
|
||||
|
@ -1,5 +1,5 @@
|
||||
//! Tests macro_metavars_in_unsafe with default configuration
|
||||
#![feature(decl_macro, lint_reasons)]
|
||||
#![feature(decl_macro)]
|
||||
#![warn(clippy::macro_metavars_in_unsafe)]
|
||||
#![allow(clippy::no_effect)]
|
||||
|
||||
|
@ -40,6 +40,7 @@ fn main() {
|
||||
|
||||
a.sort_unstable();
|
||||
|
||||
// FIXME(f16_f128): add a clamp test once the function is available
|
||||
let _ = 2.0f32.clamp(3.0f32, 4.0f32);
|
||||
let _ = 2.0f64.clamp(3.0f64, 4.0f64);
|
||||
|
||||
|
@ -28,61 +28,61 @@ LL | a.sort_unstable();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `f32::clamp`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:43:13
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:44:13
|
||||
|
|
||||
LL | let _ = 2.0f32.clamp(3.0f32, 4.0f32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `regex::Regex::new`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:46:61
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:47:61
|
||||
|
|
||||
LL | let indirect: fn(&str) -> Result<Regex, regex::Error> = Regex::new;
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `f32::clamp`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:49:28
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:50:28
|
||||
|
|
||||
LL | let in_call = Box::new(f32::clamp);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `regex::Regex::new`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:50:53
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:51:53
|
||||
|
|
||||
LL | let in_method_call = ["^", "$"].into_iter().map(Regex::new);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `futures::stream::select_all`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:53:31
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:54:31
|
||||
|
|
||||
LL | let same_name_as_module = select_all(vec![empty::<()>()]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::local_fn`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:55:5
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:56:5
|
||||
|
|
||||
LL | local_fn();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::local_mod::f`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:56:5
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:57:5
|
||||
|
|
||||
LL | local_mod::f();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::Struct::method`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:58:5
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:59:5
|
||||
|
|
||||
LL | s.method();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::Trait::provided_method`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:59:5
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:60:5
|
||||
|
|
||||
LL | s.provided_method();
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::Trait::implemented_method`
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:60:5
|
||||
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:61:5
|
||||
|
|
||||
LL | s.implemented_method();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:271:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:270:19
|
||||
|
|
||||
LL | /* Safety: */ unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -9,7 +9,7 @@ LL | /* Safety: */ unsafe {}
|
||||
= help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]`
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:275:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:274:5
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -17,7 +17,7 @@ LL | unsafe {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:14
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -25,7 +25,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:29
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:29
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -33,7 +33,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:48
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:48
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -41,7 +41,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:18
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:18
|
||||
|
|
||||
LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -49,7 +49,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:37
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:37
|
||||
|
|
||||
LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -57,7 +57,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:287:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:286:14
|
||||
|
|
||||
LL | let _ = *unsafe { &42 };
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -65,7 +65,7 @@ LL | let _ = *unsafe { &42 };
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:292:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:291:19
|
||||
|
|
||||
LL | let _ = match unsafe {} {
|
||||
| ^^^^^^^^^
|
||||
@ -73,7 +73,7 @@ LL | let _ = match unsafe {} {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:298:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:297:14
|
||||
|
|
||||
LL | let _ = &unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -81,7 +81,7 @@ LL | let _ = &unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:302:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:301:14
|
||||
|
|
||||
LL | let _ = [unsafe {}; 5];
|
||||
| ^^^^^^^^^
|
||||
@ -89,7 +89,7 @@ LL | let _ = [unsafe {}; 5];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:306:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:305:13
|
||||
|
|
||||
LL | let _ = unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -97,7 +97,7 @@ LL | let _ = unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:316:8
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:315:8
|
||||
|
|
||||
LL | t!(unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -105,7 +105,7 @@ LL | t!(unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:322:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:321:13
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -117,7 +117,7 @@ LL | t!();
|
||||
= note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:330:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:329:5
|
||||
|
|
||||
LL | unsafe {} // SAFETY:
|
||||
| ^^^^^^^^^
|
||||
@ -125,7 +125,7 @@ LL | unsafe {} // SAFETY:
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:334:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:333:5
|
||||
|
|
||||
LL | unsafe {
|
||||
| ^^^^^^^^
|
||||
@ -133,7 +133,7 @@ LL | unsafe {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:344:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:343:5
|
||||
|
|
||||
LL | unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -141,7 +141,7 @@ LL | unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:348:20
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:20
|
||||
|
|
||||
LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -149,7 +149,7 @@ LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:355:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:5
|
||||
|
|
||||
LL | unsafe impl A for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -157,7 +157,7 @@ LL | unsafe impl A for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:362:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:361:9
|
||||
|
|
||||
LL | unsafe impl B for (u32) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -165,7 +165,7 @@ LL | unsafe impl B for (u32) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:383:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:382:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -177,7 +177,7 @@ LL | no_safety_comment!(());
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -189,7 +189,7 @@ LL | no_safety_comment!(());
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:416:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:415:5
|
||||
|
|
||||
LL | unsafe impl T for (i32) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -197,7 +197,7 @@ LL | unsafe impl T for (i32) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -209,7 +209,7 @@ LL | no_safety_comment!(u32);
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:422:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:421:5
|
||||
|
|
||||
LL | unsafe impl T for (bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -217,7 +217,7 @@ LL | unsafe impl T for (bool) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:468:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:467:5
|
||||
|
|
||||
LL | unsafe impl NoComment for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -225,7 +225,7 @@ LL | unsafe impl NoComment for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:472:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:471:19
|
||||
|
|
||||
LL | /* SAFETY: */ unsafe impl InlineComment for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -233,7 +233,7 @@ LL | /* SAFETY: */ unsafe impl InlineComment for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:476:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:475:5
|
||||
|
|
||||
LL | unsafe impl TrailingComment for () {} // SAFETY:
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -241,13 +241,13 @@ LL | unsafe impl TrailingComment for () {} // SAFETY:
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: constant item has unnecessary safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
|
||||
|
|
||||
LL | const BIG_NUMBER: i32 = 1000000;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider removing the safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:478:5
|
||||
|
|
||||
LL | // SAFETY:
|
||||
| ^^^^^^^^^^
|
||||
@ -255,7 +255,7 @@ LL | // SAFETY:
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]`
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:481:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
|
||||
|
|
||||
LL | unsafe impl Interference for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -263,7 +263,7 @@ LL | unsafe impl Interference for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:488:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:487:5
|
||||
|
|
||||
LL | unsafe impl ImplInFn for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -271,7 +271,7 @@ LL | unsafe impl ImplInFn for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:497:1
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:1
|
||||
|
|
||||
LL | unsafe impl CrateRoot for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -279,7 +279,7 @@ LL | unsafe impl CrateRoot for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: statement has unnecessary safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
|
||||
|
|
||||
LL | / let _ = {
|
||||
LL | | if unsafe { true } {
|
||||
@ -291,13 +291,13 @@ LL | | };
|
||||
| |______^
|
||||
|
|
||||
help: consider removing the safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:508:5
|
||||
|
|
||||
LL | // SAFETY: this is more than one level away, so it should warn
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:511:12
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:12
|
||||
|
|
||||
LL | if unsafe { true } {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -305,7 +305,7 @@ LL | if unsafe { true } {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:514:23
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:23
|
||||
|
|
||||
LL | let bar = unsafe {};
|
||||
| ^^^^^^^^^
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:271:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:270:19
|
||||
|
|
||||
LL | /* Safety: */ unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -9,7 +9,7 @@ LL | /* Safety: */ unsafe {}
|
||||
= help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]`
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:275:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:274:5
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -17,7 +17,7 @@ LL | unsafe {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:14
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -25,7 +25,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:29
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:29
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -33,7 +33,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:279:48
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:278:48
|
||||
|
|
||||
LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -41,7 +41,7 @@ LL | let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:18
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:18
|
||||
|
|
||||
LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -49,7 +49,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:283:37
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:282:37
|
||||
|
|
||||
LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -57,7 +57,7 @@ LL | let _ = (42, unsafe {}, "test", unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:287:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:286:14
|
||||
|
|
||||
LL | let _ = *unsafe { &42 };
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -65,7 +65,7 @@ LL | let _ = *unsafe { &42 };
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:292:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:291:19
|
||||
|
|
||||
LL | let _ = match unsafe {} {
|
||||
| ^^^^^^^^^
|
||||
@ -73,7 +73,7 @@ LL | let _ = match unsafe {} {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:298:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:297:14
|
||||
|
|
||||
LL | let _ = &unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -81,7 +81,7 @@ LL | let _ = &unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:302:14
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:301:14
|
||||
|
|
||||
LL | let _ = [unsafe {}; 5];
|
||||
| ^^^^^^^^^
|
||||
@ -89,7 +89,7 @@ LL | let _ = [unsafe {}; 5];
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:306:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:305:13
|
||||
|
|
||||
LL | let _ = unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -97,7 +97,7 @@ LL | let _ = unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:316:8
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:315:8
|
||||
|
|
||||
LL | t!(unsafe {});
|
||||
| ^^^^^^^^^
|
||||
@ -105,7 +105,7 @@ LL | t!(unsafe {});
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:322:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:321:13
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -117,7 +117,7 @@ LL | t!();
|
||||
= note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:330:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:329:5
|
||||
|
|
||||
LL | unsafe {} // SAFETY:
|
||||
| ^^^^^^^^^
|
||||
@ -125,7 +125,7 @@ LL | unsafe {} // SAFETY:
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:334:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:333:5
|
||||
|
|
||||
LL | unsafe {
|
||||
| ^^^^^^^^
|
||||
@ -133,7 +133,7 @@ LL | unsafe {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:344:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:343:5
|
||||
|
|
||||
LL | unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -141,7 +141,7 @@ LL | unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:348:20
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:347:20
|
||||
|
|
||||
LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -149,7 +149,7 @@ LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:355:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:354:5
|
||||
|
|
||||
LL | unsafe impl A for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -157,7 +157,7 @@ LL | unsafe impl A for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:362:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:361:9
|
||||
|
|
||||
LL | unsafe impl B for (u32) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -165,7 +165,7 @@ LL | unsafe impl B for (u32) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:383:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:382:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -177,7 +177,7 @@ LL | no_safety_comment!(());
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -189,7 +189,7 @@ LL | no_safety_comment!(());
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:416:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:415:5
|
||||
|
|
||||
LL | unsafe impl T for (i32) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -197,7 +197,7 @@ LL | unsafe impl T for (i32) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:408:13
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:407:13
|
||||
|
|
||||
LL | unsafe impl T for $t {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -209,7 +209,7 @@ LL | no_safety_comment!(u32);
|
||||
= note: this error originates in the macro `no_safety_comment` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:422:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:421:5
|
||||
|
|
||||
LL | unsafe impl T for (bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -217,7 +217,7 @@ LL | unsafe impl T for (bool) {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:468:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:467:5
|
||||
|
|
||||
LL | unsafe impl NoComment for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -225,7 +225,7 @@ LL | unsafe impl NoComment for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:472:19
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:471:19
|
||||
|
|
||||
LL | /* SAFETY: */ unsafe impl InlineComment for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -233,7 +233,7 @@ LL | /* SAFETY: */ unsafe impl InlineComment for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:476:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:475:5
|
||||
|
|
||||
LL | unsafe impl TrailingComment for () {} // SAFETY:
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -241,13 +241,13 @@ LL | unsafe impl TrailingComment for () {} // SAFETY:
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: constant item has unnecessary safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
|
||||
|
|
||||
LL | const BIG_NUMBER: i32 = 1000000;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider removing the safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:479:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:478:5
|
||||
|
|
||||
LL | // SAFETY:
|
||||
| ^^^^^^^^^^
|
||||
@ -255,7 +255,7 @@ LL | // SAFETY:
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]`
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:481:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:480:5
|
||||
|
|
||||
LL | unsafe impl Interference for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -263,7 +263,7 @@ LL | unsafe impl Interference for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:488:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:487:5
|
||||
|
|
||||
LL | unsafe impl ImplInFn for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -271,7 +271,7 @@ LL | unsafe impl ImplInFn for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:497:1
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:496:1
|
||||
|
|
||||
LL | unsafe impl CrateRoot for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -279,7 +279,7 @@ LL | unsafe impl CrateRoot for () {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:507:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:506:9
|
||||
|
|
||||
LL | unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -287,7 +287,7 @@ LL | unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: statement has unnecessary safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
|
||||
|
|
||||
LL | / let _ = {
|
||||
LL | | if unsafe { true } {
|
||||
@ -299,13 +299,13 @@ LL | | };
|
||||
| |______^
|
||||
|
|
||||
help: consider removing the safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:509:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:508:5
|
||||
|
|
||||
LL | // SAFETY: this is more than one level away, so it should warn
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:511:12
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:510:12
|
||||
|
|
||||
LL | if unsafe { true } {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -313,7 +313,7 @@ LL | if unsafe { true } {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:514:23
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:513:23
|
||||
|
|
||||
LL | let bar = unsafe {};
|
||||
| ^^^^^^^^^
|
||||
@ -321,7 +321,7 @@ LL | let bar = unsafe {};
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:532:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:531:9
|
||||
|
|
||||
LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -329,7 +329,7 @@ LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:536:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:535:9
|
||||
|
|
||||
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -337,7 +337,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:540:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:539:9
|
||||
|
|
||||
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -345,7 +345,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:546:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:545:5
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
@ -353,7 +353,7 @@ LL | unsafe {}
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:550:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:549:5
|
||||
|
|
||||
LL | unsafe {
|
||||
| ^^^^^^^^
|
||||
@ -361,7 +361,7 @@ LL | unsafe {
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:557:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:556:9
|
||||
|
|
||||
LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -369,7 +369,7 @@ LL | unsafe { a_function_with_a_very_long_name_to_break_the_line() };
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:562:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:561:9
|
||||
|
|
||||
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -377,7 +377,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:568:9
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:567:9
|
||||
|
|
||||
LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -385,7 +385,7 @@ LL | unsafe { a_const_function_with_a_very_long_name_to_break_the_line()
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:573:5
|
||||
--> tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs:572:5
|
||||
|
|
||||
LL | unsafe {}
|
||||
| ^^^^^^^^^
|
||||
|
@ -10,7 +10,6 @@
|
||||
clippy::let_unit_value,
|
||||
clippy::missing_safety_doc
|
||||
)]
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
extern crate proc_macro_unsafe;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::allow_attributes)]
|
||||
#![feature(lint_reasons)]
|
||||
#![no_main]
|
||||
|
||||
extern crate proc_macros;
|
||||
@ -47,3 +46,15 @@ fn ignore_proc_macro() {
|
||||
fn ignore_inner_attr() {
|
||||
#![allow(unused)] // Should not lint
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.81"]
|
||||
fn msrv_1_81() {
|
||||
#[expect(unused)]
|
||||
let x = 1;
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.80"]
|
||||
fn msrv_1_80() {
|
||||
#[allow(unused)]
|
||||
let x = 1;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::allow_attributes)]
|
||||
#![feature(lint_reasons)]
|
||||
#![no_main]
|
||||
|
||||
extern crate proc_macros;
|
||||
@ -47,3 +46,15 @@ fn ignore_proc_macro() {
|
||||
fn ignore_inner_attr() {
|
||||
#![allow(unused)] // Should not lint
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.81"]
|
||||
fn msrv_1_81() {
|
||||
#[allow(unused)]
|
||||
let x = 1;
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.80"]
|
||||
fn msrv_1_80() {
|
||||
#[allow(unused)]
|
||||
let x = 1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: #[allow] attribute found
|
||||
--> tests/ui/allow_attributes.rs:13:3
|
||||
--> tests/ui/allow_attributes.rs:12:3
|
||||
|
|
||||
LL | #[allow(dead_code)]
|
||||
| ^^^^^ help: replace it with: `expect`
|
||||
@ -8,10 +8,24 @@ LL | #[allow(dead_code)]
|
||||
= help: to override `-D warnings` add `#[allow(clippy::allow_attributes)]`
|
||||
|
||||
error: #[allow] attribute found
|
||||
--> tests/ui/allow_attributes.rs:22:30
|
||||
--> tests/ui/allow_attributes.rs:21:30
|
||||
|
|
||||
LL | #[cfg_attr(panic = "unwind", allow(dead_code))]
|
||||
| ^^^^^ help: replace it with: `expect`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: #[allow] attribute found
|
||||
--> tests/ui/allow_attributes.rs:52:7
|
||||
|
|
||||
LL | #[allow(unused)]
|
||||
| ^^^^^ help: replace it with: `expect`
|
||||
|
||||
error: #[allow] attribute found
|
||||
--> tests/ui/allow_attributes.rs:52:7
|
||||
|
|
||||
LL | #[allow(unused)]
|
||||
| ^^^^^ help: replace it with: `expect`
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
#![feature(lint_reasons)]
|
||||
#![deny(clippy::allow_attributes_without_reason)]
|
||||
#![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)]
|
||||
|
||||
@ -42,3 +41,15 @@ pub fn trigger_fp_result() -> Result<(), &'static str> {
|
||||
Err("asdf")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.81"]
|
||||
fn msrv_1_81() {
|
||||
#[allow(unused)]
|
||||
let _ = 1;
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.80"]
|
||||
fn msrv_1_80() {
|
||||
#[allow(unused)]
|
||||
let _ = 1;
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:4:1
|
||||
--> tests/ui/allow_attributes_without_reason.rs:3:1
|
||||
|
|
||||
LL | #![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
note: the lint level is defined here
|
||||
--> tests/ui/allow_attributes_without_reason.rs:3:9
|
||||
--> tests/ui/allow_attributes_without_reason.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::allow_attributes_without_reason)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:10:1
|
||||
--> tests/ui/allow_attributes_without_reason.rs:9:1
|
||||
|
|
||||
LL | #[allow(dead_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -20,7 +20,7 @@ LL | #[allow(dead_code)]
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:11:1
|
||||
--> tests/ui/allow_attributes_without_reason.rs:10:1
|
||||
|
|
||||
LL | #[allow(dead_code, deprecated)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -28,12 +28,29 @@ LL | #[allow(dead_code, deprecated)]
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
|
||||
error: `expect` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:12:1
|
||||
--> tests/ui/allow_attributes_without_reason.rs:11:1
|
||||
|
|
||||
LL | #[expect(dead_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:47:5
|
||||
|
|
||||
LL | #[allow(unused)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> tests/ui/allow_attributes_without_reason.rs:47:5
|
||||
|
|
||||
LL | #[allow(unused)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
unconditional_panic
|
||||
)]
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(f128)]
|
||||
#![feature(f16)]
|
||||
#![warn(clippy::arithmetic_side_effects)]
|
||||
|
||||
extern crate proc_macro_derive;
|
||||
@ -162,8 +164,10 @@ pub fn association_with_structures_should_not_trigger_the_lint() {
|
||||
}
|
||||
|
||||
pub fn hard_coded_allowed() {
|
||||
let _ = 1f16 + 1f16;
|
||||
let _ = 1f32 + 1f32;
|
||||
let _ = 1f64 + 1f64;
|
||||
let _ = 1f128 + 1f128;
|
||||
|
||||
let _ = Saturating(0u32) + Saturating(0u32);
|
||||
let _ = String::new() + "";
|
||||
|
@ -1,731 +1,743 @@
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:304:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:167:13
|
||||
|
|
||||
LL | _n += 1;
|
||||
| ^^^^^^^
|
||||
LL | let _ = 1f16 + 1f16;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]`
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:305:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:170:13
|
||||
|
|
||||
LL | _n += &1;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:306:5
|
||||
|
|
||||
LL | _n -= 1;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:307:5
|
||||
|
|
||||
LL | _n -= &1;
|
||||
| ^^^^^^^^
|
||||
LL | let _ = 1f128 + 1f128;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:308:5
|
||||
|
|
||||
LL | _n /= 0;
|
||||
LL | _n += 1;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:309:5
|
||||
|
|
||||
LL | _n /= &0;
|
||||
LL | _n += &1;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:310:5
|
||||
|
|
||||
LL | _n %= 0;
|
||||
LL | _n -= 1;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:311:5
|
||||
|
|
||||
LL | _n %= &0;
|
||||
LL | _n -= &1;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:312:5
|
||||
|
|
||||
LL | _n *= 2;
|
||||
LL | _n /= 0;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:313:5
|
||||
|
|
||||
LL | _n *= &2;
|
||||
LL | _n /= &0;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:314:5
|
||||
|
|
||||
LL | _n += -1;
|
||||
| ^^^^^^^^
|
||||
LL | _n %= 0;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:315:5
|
||||
|
|
||||
LL | _n += &-1;
|
||||
| ^^^^^^^^^
|
||||
LL | _n %= &0;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:316:5
|
||||
|
|
||||
LL | _n -= -1;
|
||||
| ^^^^^^^^
|
||||
LL | _n *= 2;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:317:5
|
||||
|
|
||||
LL | _n -= &-1;
|
||||
| ^^^^^^^^^
|
||||
LL | _n *= &2;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:318:5
|
||||
|
|
||||
LL | _n /= -0;
|
||||
LL | _n += -1;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:319:5
|
||||
|
|
||||
LL | _n /= &-0;
|
||||
LL | _n += &-1;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:320:5
|
||||
|
|
||||
LL | _n %= -0;
|
||||
LL | _n -= -1;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:321:5
|
||||
|
|
||||
LL | _n %= &-0;
|
||||
LL | _n -= &-1;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:322:5
|
||||
|
|
||||
LL | _n *= -2;
|
||||
LL | _n /= -0;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:323:5
|
||||
|
|
||||
LL | _n *= &-2;
|
||||
LL | _n /= &-0;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:324:5
|
||||
|
|
||||
LL | _custom += Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
LL | _n %= -0;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:325:5
|
||||
|
|
||||
LL | _custom += &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
LL | _n %= &-0;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:326:5
|
||||
|
|
||||
LL | _custom -= Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
LL | _n *= -2;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:327:5
|
||||
|
|
||||
LL | _custom -= &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
LL | _n *= &-2;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:328:5
|
||||
|
|
||||
LL | _custom /= Custom;
|
||||
LL | _custom += Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:329:5
|
||||
|
|
||||
LL | _custom /= &Custom;
|
||||
LL | _custom += &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:330:5
|
||||
|
|
||||
LL | _custom %= Custom;
|
||||
LL | _custom -= Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:331:5
|
||||
|
|
||||
LL | _custom %= &Custom;
|
||||
LL | _custom -= &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:332:5
|
||||
|
|
||||
LL | _custom *= Custom;
|
||||
LL | _custom /= Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:333:5
|
||||
|
|
||||
LL | _custom *= &Custom;
|
||||
LL | _custom /= &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:334:5
|
||||
|
|
||||
LL | _custom >>= Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
LL | _custom %= Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:335:5
|
||||
|
|
||||
LL | _custom >>= &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
LL | _custom %= &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:336:5
|
||||
|
|
||||
LL | _custom <<= Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
LL | _custom *= Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:337:5
|
||||
|
|
||||
LL | _custom <<= &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
LL | _custom *= &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:338:5
|
||||
|
|
||||
LL | _custom += -Custom;
|
||||
LL | _custom >>= Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:339:5
|
||||
|
|
||||
LL | _custom += &-Custom;
|
||||
LL | _custom >>= &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:340:5
|
||||
|
|
||||
LL | _custom -= -Custom;
|
||||
LL | _custom <<= Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:341:5
|
||||
|
|
||||
LL | _custom -= &-Custom;
|
||||
LL | _custom <<= &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:342:5
|
||||
|
|
||||
LL | _custom /= -Custom;
|
||||
LL | _custom += -Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:343:5
|
||||
|
|
||||
LL | _custom /= &-Custom;
|
||||
LL | _custom += &-Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:344:5
|
||||
|
|
||||
LL | _custom %= -Custom;
|
||||
LL | _custom -= -Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:345:5
|
||||
|
|
||||
LL | _custom %= &-Custom;
|
||||
LL | _custom -= &-Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:346:5
|
||||
|
|
||||
LL | _custom *= -Custom;
|
||||
LL | _custom /= -Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:347:5
|
||||
|
|
||||
LL | _custom *= &-Custom;
|
||||
LL | _custom /= &-Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:348:5
|
||||
|
|
||||
LL | _custom %= -Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:349:5
|
||||
|
|
||||
LL | _custom %= &-Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:350:5
|
||||
|
|
||||
LL | _custom *= -Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:351:5
|
||||
|
|
||||
LL | _custom *= &-Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:352:5
|
||||
|
|
||||
LL | _custom >>= -Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:349:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:353:5
|
||||
|
|
||||
LL | _custom >>= &-Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:350:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:354:5
|
||||
|
|
||||
LL | _custom <<= -Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:351:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:355:5
|
||||
|
|
||||
LL | _custom <<= &-Custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:354:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:358:10
|
||||
|
|
||||
LL | _n = _n + 1;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:355:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:359:10
|
||||
|
|
||||
LL | _n = _n + &1;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:356:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:360:10
|
||||
|
|
||||
LL | _n = 1 + _n;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:357:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:361:10
|
||||
|
|
||||
LL | _n = &1 + _n;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:358:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:362:10
|
||||
|
|
||||
LL | _n = _n - 1;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:359:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:363:10
|
||||
|
|
||||
LL | _n = _n - &1;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:360:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:364:10
|
||||
|
|
||||
LL | _n = 1 - _n;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:361:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:365:10
|
||||
|
|
||||
LL | _n = &1 - _n;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:362:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:366:10
|
||||
|
|
||||
LL | _n = _n / 0;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:363:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:367:10
|
||||
|
|
||||
LL | _n = _n / &0;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:364:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:368:10
|
||||
|
|
||||
LL | _n = _n % 0;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:365:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:369:10
|
||||
|
|
||||
LL | _n = _n % &0;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:366:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:370:10
|
||||
|
|
||||
LL | _n = _n * 2;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:367:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:371:10
|
||||
|
|
||||
LL | _n = _n * &2;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:368:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:372:10
|
||||
|
|
||||
LL | _n = 2 * _n;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:369:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:373:10
|
||||
|
|
||||
LL | _n = &2 * _n;
|
||||
| ^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:370:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:374:10
|
||||
|
|
||||
LL | _n = 23 + &85;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:371:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:375:10
|
||||
|
|
||||
LL | _n = &23 + 85;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:372:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:376:10
|
||||
|
|
||||
LL | _n = &23 + &85;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:373:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:377:15
|
||||
|
|
||||
LL | _custom = _custom + _custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:374:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:378:15
|
||||
|
|
||||
LL | _custom = _custom + &_custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:375:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:379:15
|
||||
|
|
||||
LL | _custom = Custom + _custom;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:376:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:380:15
|
||||
|
|
||||
LL | _custom = &Custom + _custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:377:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:381:15
|
||||
|
|
||||
LL | _custom = _custom - Custom;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:378:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:382:15
|
||||
|
|
||||
LL | _custom = _custom - &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:379:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:383:15
|
||||
|
|
||||
LL | _custom = Custom - _custom;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:380:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:384:15
|
||||
|
|
||||
LL | _custom = &Custom - _custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:381:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:385:15
|
||||
|
|
||||
LL | _custom = _custom / Custom;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:382:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:386:15
|
||||
|
|
||||
LL | _custom = _custom / &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:383:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:387:15
|
||||
|
|
||||
LL | _custom = _custom % Custom;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:384:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:388:15
|
||||
|
|
||||
LL | _custom = _custom % &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:385:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:389:15
|
||||
|
|
||||
LL | _custom = _custom * Custom;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:386:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:390:15
|
||||
|
|
||||
LL | _custom = _custom * &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:387:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:391:15
|
||||
|
|
||||
LL | _custom = Custom * _custom;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:388:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:392:15
|
||||
|
|
||||
LL | _custom = &Custom * _custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:389:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:393:15
|
||||
|
|
||||
LL | _custom = Custom + &Custom;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:390:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:394:15
|
||||
|
|
||||
LL | _custom = &Custom + Custom;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:391:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:395:15
|
||||
|
|
||||
LL | _custom = &Custom + &Custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:392:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:396:15
|
||||
|
|
||||
LL | _custom = _custom >> _custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:393:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:397:15
|
||||
|
|
||||
LL | _custom = _custom >> &_custom;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:394:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:398:15
|
||||
|
|
||||
LL | _custom = Custom << _custom;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:395:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:399:15
|
||||
|
|
||||
LL | _custom = &Custom << _custom;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:398:23
|
||||
--> tests/ui/arithmetic_side_effects.rs:402:23
|
||||
|
|
||||
LL | _n.saturating_div(0);
|
||||
| ^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:399:21
|
||||
--> tests/ui/arithmetic_side_effects.rs:403:21
|
||||
|
|
||||
LL | _n.wrapping_div(0);
|
||||
| ^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:400:21
|
||||
--> tests/ui/arithmetic_side_effects.rs:404:21
|
||||
|
|
||||
LL | _n.wrapping_rem(0);
|
||||
| ^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:401:28
|
||||
--> tests/ui/arithmetic_side_effects.rs:405:28
|
||||
|
|
||||
LL | _n.wrapping_rem_euclid(0);
|
||||
| ^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:403:23
|
||||
--> tests/ui/arithmetic_side_effects.rs:407:23
|
||||
|
|
||||
LL | _n.saturating_div(_n);
|
||||
| ^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:404:21
|
||||
--> tests/ui/arithmetic_side_effects.rs:408:21
|
||||
|
|
||||
LL | _n.wrapping_div(_n);
|
||||
| ^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:405:21
|
||||
--> tests/ui/arithmetic_side_effects.rs:409:21
|
||||
|
|
||||
LL | _n.wrapping_rem(_n);
|
||||
| ^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:406:28
|
||||
--> tests/ui/arithmetic_side_effects.rs:410:28
|
||||
|
|
||||
LL | _n.wrapping_rem_euclid(_n);
|
||||
| ^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:409:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:413:10
|
||||
|
|
||||
LL | _n = -_n;
|
||||
| ^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:410:10
|
||||
--> tests/ui/arithmetic_side_effects.rs:414:10
|
||||
|
|
||||
LL | _n = -&_n;
|
||||
| ^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:411:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:415:15
|
||||
|
|
||||
LL | _custom = -_custom;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:412:15
|
||||
--> tests/ui/arithmetic_side_effects.rs:416:15
|
||||
|
|
||||
LL | _custom = -&_custom;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:421:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:425:5
|
||||
|
|
||||
LL | 1 + i;
|
||||
| ^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:422:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:426:5
|
||||
|
|
||||
LL | i * 2;
|
||||
| ^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:423:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:427:5
|
||||
|
|
||||
LL | 1 % i / 2;
|
||||
| ^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:424:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:428:5
|
||||
|
|
||||
LL | i - 2 + 2 - i;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:425:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:429:5
|
||||
|
|
||||
LL | -i;
|
||||
| ^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:436:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:440:5
|
||||
|
|
||||
LL | i += 1;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:437:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:441:5
|
||||
|
|
||||
LL | i -= 1;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:438:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:442:5
|
||||
|
|
||||
LL | i *= 2;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:440:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:444:5
|
||||
|
|
||||
LL | i /= 0;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:442:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:446:5
|
||||
|
|
||||
LL | i /= var1;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:443:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:447:5
|
||||
|
|
||||
LL | i /= var2;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:445:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:449:5
|
||||
|
|
||||
LL | i %= 0;
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:447:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:451:5
|
||||
|
|
||||
LL | i %= var1;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:448:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:452:5
|
||||
|
|
||||
LL | i %= var2;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:458:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:462:5
|
||||
|
|
||||
LL | 10 / a
|
||||
| ^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:512:9
|
||||
--> tests/ui/arithmetic_side_effects.rs:516:9
|
||||
|
|
||||
LL | x / maybe_zero
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:516:9
|
||||
--> tests/ui/arithmetic_side_effects.rs:520:9
|
||||
|
|
||||
LL | x % maybe_zero
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:527:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:531:5
|
||||
|
|
||||
LL | one.add_assign(1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> tests/ui/arithmetic_side_effects.rs:531:5
|
||||
--> tests/ui/arithmetic_side_effects.rs:535:5
|
||||
|
|
||||
LL | one.sub_assign(1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 121 previous errors
|
||||
error: aborting due to 123 previous errors
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(async_closure)]
|
||||
#![warn(clippy::async_yields_async)]
|
||||
#![allow(clippy::redundant_async_block)]
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![feature(async_closure)]
|
||||
#![warn(clippy::async_yields_async)]
|
||||
#![allow(clippy::redundant_async_block)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:39:9
|
||||
--> tests/ui/async_yields_async.rs:38:9
|
||||
|
|
||||
LL | let _h = async {
|
||||
| _____________________-
|
||||
@ -20,7 +20,7 @@ LL + }.await
|
||||
|
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:44:9
|
||||
--> tests/ui/async_yields_async.rs:43:9
|
||||
|
|
||||
LL | let _i = async {
|
||||
| ____________________-
|
||||
@ -33,7 +33,7 @@ LL | | };
|
||||
| |_____- outer async construct
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:50:9
|
||||
--> tests/ui/async_yields_async.rs:49:9
|
||||
|
|
||||
LL | let _j = async || {
|
||||
| ________________________-
|
||||
@ -52,7 +52,7 @@ LL + }.await
|
||||
|
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:55:9
|
||||
--> tests/ui/async_yields_async.rs:54:9
|
||||
|
|
||||
LL | let _k = async || {
|
||||
| _______________________-
|
||||
@ -65,7 +65,7 @@ LL | | };
|
||||
| |_____- outer async construct
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:57:23
|
||||
--> tests/ui/async_yields_async.rs:56:23
|
||||
|
|
||||
LL | let _l = async || CustomFutureType;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
@ -75,7 +75,7 @@ LL | let _l = async || CustomFutureType;
|
||||
| help: consider awaiting this value: `CustomFutureType.await`
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> tests/ui/async_yields_async.rs:63:9
|
||||
--> tests/ui/async_yields_async.rs:62:9
|
||||
|
|
||||
LL | let _m = async || {
|
||||
| _______________________-
|
||||
|
@ -62,7 +62,7 @@ LL | }
|
||||
LL | match s.len() {
|
||||
LL ~ 10 => 2,
|
||||
LL | 20 => {
|
||||
...
|
||||
...
|
||||
LL | if foo() {
|
||||
LL ~ return 20;
|
||||
LL | }
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(
|
||||
clippy::borrowed_box,
|
||||
clippy::needless_pass_by_value,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> tests/ui/boxed_local.rs:40:13
|
||||
--> tests/ui/boxed_local.rs:39:13
|
||||
|
|
||||
LL | fn warn_arg(x: Box<A>) {
|
||||
| ^
|
||||
@ -8,19 +8,19 @@ LL | fn warn_arg(x: Box<A>) {
|
||||
= help: to override `-D warnings` add `#[allow(clippy::boxed_local)]`
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> tests/ui/boxed_local.rs:123:12
|
||||
--> tests/ui/boxed_local.rs:122:12
|
||||
|
|
||||
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> tests/ui/boxed_local.rs:188:44
|
||||
--> tests/ui/boxed_local.rs:187:44
|
||||
|
|
||||
LL | fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 {
|
||||
| ^
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> tests/ui/boxed_local.rs:196:16
|
||||
--> tests/ui/boxed_local.rs:195:16
|
||||
|
|
||||
LL | fn foo(x: Box<u32>) {}
|
||||
| ^
|
||||
|
@ -18,6 +18,8 @@
|
||||
clippy::identity_op
|
||||
)]
|
||||
|
||||
// FIXME(f16_f128): add tests once const casting is available for these types
|
||||
|
||||
fn main() {
|
||||
// Test clippy::cast_precision_loss
|
||||
let x0 = 1i32;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast.rs:24:5
|
||||
--> tests/ui/cast.rs:26:5
|
||||
|
|
||||
LL | x0 as f32;
|
||||
| ^^^^^^^^^
|
||||
@ -8,37 +8,37 @@ LL | x0 as f32;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
|
||||
|
||||
error: casting `i64` to `f32` causes a loss of precision (`i64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast.rs:28:5
|
||||
--> tests/ui/cast.rs:30:5
|
||||
|
|
||||
LL | x1 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `i64` to `f64` causes a loss of precision (`i64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast.rs:30:5
|
||||
--> tests/ui/cast.rs:32:5
|
||||
|
|
||||
LL | x1 as f64;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `u32` to `f32` causes a loss of precision (`u32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast.rs:33:5
|
||||
--> tests/ui/cast.rs:35:5
|
||||
|
|
||||
LL | x2 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `u64` to `f32` causes a loss of precision (`u64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast.rs:36:5
|
||||
--> tests/ui/cast.rs:38:5
|
||||
|
|
||||
LL | x3 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `u64` to `f64` causes a loss of precision (`u64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast.rs:38:5
|
||||
--> tests/ui/cast.rs:40:5
|
||||
|
|
||||
LL | x3 as f64;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `f32` to `i32` may truncate the value
|
||||
--> tests/ui/cast.rs:41:5
|
||||
--> tests/ui/cast.rs:43:5
|
||||
|
|
||||
LL | 1f32 as i32;
|
||||
| ^^^^^^^^^^^
|
||||
@ -48,7 +48,7 @@ LL | 1f32 as i32;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]`
|
||||
|
||||
error: casting `f32` to `u32` may truncate the value
|
||||
--> tests/ui/cast.rs:43:5
|
||||
--> tests/ui/cast.rs:45:5
|
||||
|
|
||||
LL | 1f32 as u32;
|
||||
| ^^^^^^^^^^^
|
||||
@ -56,7 +56,7 @@ LL | 1f32 as u32;
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
|
||||
error: casting `f32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:43:5
|
||||
--> tests/ui/cast.rs:45:5
|
||||
|
|
||||
LL | 1f32 as u32;
|
||||
| ^^^^^^^^^^^
|
||||
@ -65,7 +65,7 @@ LL | 1f32 as u32;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_sign_loss)]`
|
||||
|
||||
error: casting `f64` to `f32` may truncate the value
|
||||
--> tests/ui/cast.rs:47:5
|
||||
--> tests/ui/cast.rs:49:5
|
||||
|
|
||||
LL | 1f64 as f32;
|
||||
| ^^^^^^^^^^^
|
||||
@ -73,7 +73,7 @@ LL | 1f64 as f32;
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
|
||||
error: casting `i32` to `i8` may truncate the value
|
||||
--> tests/ui/cast.rs:49:5
|
||||
--> tests/ui/cast.rs:51:5
|
||||
|
|
||||
LL | 1i32 as i8;
|
||||
| ^^^^^^^^^^
|
||||
@ -85,7 +85,7 @@ LL | i8::try_from(1i32);
|
||||
| ~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `i32` to `u8` may truncate the value
|
||||
--> tests/ui/cast.rs:51:5
|
||||
--> tests/ui/cast.rs:53:5
|
||||
|
|
||||
LL | 1i32 as u8;
|
||||
| ^^^^^^^^^^
|
||||
@ -97,7 +97,7 @@ LL | u8::try_from(1i32);
|
||||
| ~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `f64` to `isize` may truncate the value
|
||||
--> tests/ui/cast.rs:53:5
|
||||
--> tests/ui/cast.rs:55:5
|
||||
|
|
||||
LL | 1f64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -105,7 +105,7 @@ LL | 1f64 as isize;
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
|
||||
error: casting `f64` to `usize` may truncate the value
|
||||
--> tests/ui/cast.rs:55:5
|
||||
--> tests/ui/cast.rs:57:5
|
||||
|
|
||||
LL | 1f64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -113,13 +113,13 @@ LL | 1f64 as usize;
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
|
||||
error: casting `f64` to `usize` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:55:5
|
||||
--> tests/ui/cast.rs:57:5
|
||||
|
|
||||
LL | 1f64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `u32` to `u16` may truncate the value
|
||||
--> tests/ui/cast.rs:58:5
|
||||
--> tests/ui/cast.rs:60:5
|
||||
|
|
||||
LL | 1f32 as u32 as u16;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -131,7 +131,7 @@ LL | u16::try_from(1f32 as u32);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `f32` to `u32` may truncate the value
|
||||
--> tests/ui/cast.rs:58:5
|
||||
--> tests/ui/cast.rs:60:5
|
||||
|
|
||||
LL | 1f32 as u32 as u16;
|
||||
| ^^^^^^^^^^^
|
||||
@ -139,13 +139,13 @@ LL | 1f32 as u32 as u16;
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
|
||||
error: casting `f32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:58:5
|
||||
--> tests/ui/cast.rs:60:5
|
||||
|
|
||||
LL | 1f32 as u32 as u16;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `i8` may truncate the value
|
||||
--> tests/ui/cast.rs:63:22
|
||||
--> tests/ui/cast.rs:65:22
|
||||
|
|
||||
LL | let _x: i8 = 1i32 as _;
|
||||
| ^^^^^^^^^
|
||||
@ -157,7 +157,7 @@ LL | let _x: i8 = 1i32.try_into();
|
||||
| ~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `f32` to `i32` may truncate the value
|
||||
--> tests/ui/cast.rs:65:9
|
||||
--> tests/ui/cast.rs:67:9
|
||||
|
|
||||
LL | 1f32 as i32;
|
||||
| ^^^^^^^^^^^
|
||||
@ -165,7 +165,7 @@ LL | 1f32 as i32;
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
|
||||
error: casting `f64` to `i32` may truncate the value
|
||||
--> tests/ui/cast.rs:67:9
|
||||
--> tests/ui/cast.rs:69:9
|
||||
|
|
||||
LL | 1f64 as i32;
|
||||
| ^^^^^^^^^^^
|
||||
@ -173,7 +173,7 @@ LL | 1f64 as i32;
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
|
||||
error: casting `f32` to `u8` may truncate the value
|
||||
--> tests/ui/cast.rs:69:9
|
||||
--> tests/ui/cast.rs:71:9
|
||||
|
|
||||
LL | 1f32 as u8;
|
||||
| ^^^^^^^^^^
|
||||
@ -181,13 +181,13 @@ LL | 1f32 as u8;
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
|
||||
error: casting `f32` to `u8` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:69:9
|
||||
--> tests/ui/cast.rs:71:9
|
||||
|
|
||||
LL | 1f32 as u8;
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: casting `u8` to `i8` may wrap around the value
|
||||
--> tests/ui/cast.rs:74:5
|
||||
--> tests/ui/cast.rs:76:5
|
||||
|
|
||||
LL | 1u8 as i8;
|
||||
| ^^^^^^^^^
|
||||
@ -196,31 +196,31 @@ LL | 1u8 as i8;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
|
||||
|
||||
error: casting `u16` to `i16` may wrap around the value
|
||||
--> tests/ui/cast.rs:77:5
|
||||
--> tests/ui/cast.rs:79:5
|
||||
|
|
||||
LL | 1u16 as i16;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: casting `u32` to `i32` may wrap around the value
|
||||
--> tests/ui/cast.rs:79:5
|
||||
--> tests/ui/cast.rs:81:5
|
||||
|
|
||||
LL | 1u32 as i32;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: casting `u64` to `i64` may wrap around the value
|
||||
--> tests/ui/cast.rs:81:5
|
||||
--> tests/ui/cast.rs:83:5
|
||||
|
|
||||
LL | 1u64 as i64;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: casting `usize` to `isize` may wrap around the value
|
||||
--> tests/ui/cast.rs:83:5
|
||||
--> tests/ui/cast.rs:85:5
|
||||
|
|
||||
LL | 1usize as isize;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `usize` to `i8` may truncate the value
|
||||
--> tests/ui/cast.rs:86:5
|
||||
--> tests/ui/cast.rs:88:5
|
||||
|
|
||||
LL | 1usize as i8;
|
||||
| ^^^^^^^^^^^^
|
||||
@ -232,7 +232,7 @@ LL | i8::try_from(1usize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `usize` to `i16` may truncate the value
|
||||
--> tests/ui/cast.rs:89:5
|
||||
--> tests/ui/cast.rs:91:5
|
||||
|
|
||||
LL | 1usize as i16;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -244,7 +244,7 @@ LL | i16::try_from(1usize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `usize` to `i16` may wrap around the value on targets with 16-bit wide pointers
|
||||
--> tests/ui/cast.rs:89:5
|
||||
--> tests/ui/cast.rs:91:5
|
||||
|
|
||||
LL | 1usize as i16;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -253,7 +253,7 @@ LL | 1usize as i16;
|
||||
= note: for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types
|
||||
|
||||
error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast.rs:94:5
|
||||
--> tests/ui/cast.rs:96:5
|
||||
|
|
||||
LL | 1usize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -265,19 +265,19 @@ LL | i32::try_from(1usize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast.rs:94:5
|
||||
--> tests/ui/cast.rs:96:5
|
||||
|
|
||||
LL | 1usize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `usize` to `i64` may wrap around the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast.rs:98:5
|
||||
--> tests/ui/cast.rs:100:5
|
||||
|
|
||||
LL | 1usize as i64;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `u16` to `isize` may wrap around the value on targets with 16-bit wide pointers
|
||||
--> tests/ui/cast.rs:103:5
|
||||
--> tests/ui/cast.rs:105:5
|
||||
|
|
||||
LL | 1u16 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -286,13 +286,13 @@ LL | 1u16 as isize;
|
||||
= note: for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types
|
||||
|
||||
error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast.rs:107:5
|
||||
--> tests/ui/cast.rs:109:5
|
||||
|
|
||||
LL | 1u32 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast.rs:110:5
|
||||
--> tests/ui/cast.rs:112:5
|
||||
|
|
||||
LL | 1u64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -304,55 +304,55 @@ LL | isize::try_from(1u64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast.rs:110:5
|
||||
--> tests/ui/cast.rs:112:5
|
||||
|
|
||||
LL | 1u64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:115:5
|
||||
--> tests/ui/cast.rs:117:5
|
||||
|
|
||||
LL | -1i32 as u32;
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: casting `isize` to `usize` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:118:5
|
||||
--> tests/ui/cast.rs:120:5
|
||||
|
|
||||
LL | -1isize as usize;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i8` to `u8` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:129:5
|
||||
--> tests/ui/cast.rs:131:5
|
||||
|
|
||||
LL | (i8::MIN).abs() as u8;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i64` to `u64` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:133:5
|
||||
--> tests/ui/cast.rs:135:5
|
||||
|
|
||||
LL | (-1i64).abs() as u64;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `isize` to `usize` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:134:5
|
||||
--> tests/ui/cast.rs:136:5
|
||||
|
|
||||
LL | (-1isize).abs() as usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i64` to `u64` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:141:5
|
||||
--> tests/ui/cast.rs:143:5
|
||||
|
|
||||
LL | (unsafe { (-1i64).checked_abs().unwrap_unchecked() }) as u64;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i64` to `u64` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:156:5
|
||||
--> tests/ui/cast.rs:158:5
|
||||
|
|
||||
LL | (unsafe { (-1i64).checked_isqrt().unwrap_unchecked() }) as u64;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i64` to `i8` may truncate the value
|
||||
--> tests/ui/cast.rs:207:5
|
||||
--> tests/ui/cast.rs:209:5
|
||||
|
|
||||
LL | (-99999999999i64).min(1) as i8;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -364,7 +364,7 @@ LL | i8::try_from((-99999999999i64).min(1));
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u64` to `u8` may truncate the value
|
||||
--> tests/ui/cast.rs:221:5
|
||||
--> tests/ui/cast.rs:223:5
|
||||
|
|
||||
LL | 999999u64.clamp(0, 256) as u8;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -376,7 +376,7 @@ LL | u8::try_from(999999u64.clamp(0, 256));
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `main::E2` to `u8` may truncate the value
|
||||
--> tests/ui/cast.rs:244:21
|
||||
--> tests/ui/cast.rs:246:21
|
||||
|
|
||||
LL | let _ = self as u8;
|
||||
| ^^^^^^^^^^
|
||||
@ -388,7 +388,7 @@ LL | let _ = u8::try_from(self);
|
||||
| ~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `main::E2::B` to `u8` will truncate the value
|
||||
--> tests/ui/cast.rs:246:21
|
||||
--> tests/ui/cast.rs:248:21
|
||||
|
|
||||
LL | let _ = Self::B as u8;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -397,7 +397,7 @@ LL | let _ = Self::B as u8;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_enum_truncation)]`
|
||||
|
||||
error: casting `main::E5` to `i8` may truncate the value
|
||||
--> tests/ui/cast.rs:288:21
|
||||
--> tests/ui/cast.rs:290:21
|
||||
|
|
||||
LL | let _ = self as i8;
|
||||
| ^^^^^^^^^^
|
||||
@ -409,13 +409,13 @@ LL | let _ = i8::try_from(self);
|
||||
| ~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `main::E5::A` to `i8` will truncate the value
|
||||
--> tests/ui/cast.rs:290:21
|
||||
--> tests/ui/cast.rs:292:21
|
||||
|
|
||||
LL | let _ = Self::A as i8;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `main::E6` to `i16` may truncate the value
|
||||
--> tests/ui/cast.rs:307:21
|
||||
--> tests/ui/cast.rs:309:21
|
||||
|
|
||||
LL | let _ = self as i16;
|
||||
| ^^^^^^^^^^^
|
||||
@ -427,7 +427,7 @@ LL | let _ = i16::try_from(self);
|
||||
| ~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `main::E7` to `usize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast.rs:326:21
|
||||
--> tests/ui/cast.rs:328:21
|
||||
|
|
||||
LL | let _ = self as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -439,7 +439,7 @@ LL | let _ = usize::try_from(self);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `main::E10` to `u16` may truncate the value
|
||||
--> tests/ui/cast.rs:373:21
|
||||
--> tests/ui/cast.rs:375:21
|
||||
|
|
||||
LL | let _ = self as u16;
|
||||
| ^^^^^^^^^^^
|
||||
@ -451,7 +451,7 @@ LL | let _ = u16::try_from(self);
|
||||
| ~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u32` to `u8` may truncate the value
|
||||
--> tests/ui/cast.rs:384:13
|
||||
--> tests/ui/cast.rs:386:13
|
||||
|
|
||||
LL | let c = (q >> 16) as u8;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -463,7 +463,7 @@ LL | let c = u8::try_from(q >> 16);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u32` to `u8` may truncate the value
|
||||
--> tests/ui/cast.rs:388:13
|
||||
--> tests/ui/cast.rs:390:13
|
||||
|
|
||||
LL | let c = (q / 1000) as u8;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
@ -475,85 +475,85 @@ LL | let c = u8::try_from(q / 1000);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:400:9
|
||||
--> tests/ui/cast.rs:402:9
|
||||
|
|
||||
LL | (x * x) as u32;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:405:32
|
||||
--> tests/ui/cast.rs:407:32
|
||||
|
|
||||
LL | let _a = |x: i32| -> u32 { (x * x * x * x) as u32 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:407:5
|
||||
--> tests/ui/cast.rs:409:5
|
||||
|
|
||||
LL | (2_i32).checked_pow(3).unwrap() as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:408:5
|
||||
--> tests/ui/cast.rs:410:5
|
||||
|
|
||||
LL | (-2_i32).pow(3) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:413:5
|
||||
--> tests/ui/cast.rs:415:5
|
||||
|
|
||||
LL | (-5_i32 % 2) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:415:5
|
||||
--> tests/ui/cast.rs:417:5
|
||||
|
|
||||
LL | (-5_i32 % -2) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:418:5
|
||||
--> tests/ui/cast.rs:420:5
|
||||
|
|
||||
LL | (-2_i32 >> 1) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:422:5
|
||||
--> tests/ui/cast.rs:424:5
|
||||
|
|
||||
LL | (x * x) as u32;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:423:5
|
||||
--> tests/ui/cast.rs:425:5
|
||||
|
|
||||
LL | (x * x * x) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i16` to `u16` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:427:5
|
||||
--> tests/ui/cast.rs:429:5
|
||||
|
|
||||
LL | (y * y * y * y * -2) as u16;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i16` to `u16` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:429:5
|
||||
--> tests/ui/cast.rs:431:5
|
||||
|
|
||||
LL | (y * y * y / y * 2) as u16;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i16` to `u16` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:430:5
|
||||
--> tests/ui/cast.rs:432:5
|
||||
|
|
||||
LL | (y * y / y * 2) as u16;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i16` to `u16` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:432:5
|
||||
--> tests/ui/cast.rs:434:5
|
||||
|
|
||||
LL | (y / y * y * -2) as u16;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: equal expressions as operands to `/`
|
||||
--> tests/ui/cast.rs:432:6
|
||||
--> tests/ui/cast.rs:434:6
|
||||
|
|
||||
LL | (y / y * y * -2) as u16;
|
||||
| ^^^^^
|
||||
@ -561,97 +561,97 @@ LL | (y / y * y * -2) as u16;
|
||||
= note: `#[deny(clippy::eq_op)]` on by default
|
||||
|
||||
error: casting `i16` to `u16` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:435:5
|
||||
--> tests/ui/cast.rs:437:5
|
||||
|
|
||||
LL | (y + y + y + -2) as u16;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i16` to `u16` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:437:5
|
||||
--> tests/ui/cast.rs:439:5
|
||||
|
|
||||
LL | (y + y + y + 2) as u16;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i16` to `u16` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:441:5
|
||||
--> tests/ui/cast.rs:443:5
|
||||
|
|
||||
LL | (z + -2) as u16;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i16` to `u16` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:443:5
|
||||
--> tests/ui/cast.rs:445:5
|
||||
|
|
||||
LL | (z + z + 2) as u16;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:446:9
|
||||
--> tests/ui/cast.rs:448:9
|
||||
|
|
||||
LL | (a * a * b * b * c * c) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:447:9
|
||||
--> tests/ui/cast.rs:449:9
|
||||
|
|
||||
LL | (a * b * c) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:449:9
|
||||
--> tests/ui/cast.rs:451:9
|
||||
|
|
||||
LL | (a * -b * c) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:451:9
|
||||
--> tests/ui/cast.rs:453:9
|
||||
|
|
||||
LL | (a * b * c * c) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:452:9
|
||||
--> tests/ui/cast.rs:454:9
|
||||
|
|
||||
LL | (a * -2) as u32;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:454:9
|
||||
--> tests/ui/cast.rs:456:9
|
||||
|
|
||||
LL | (a * b * c * -2) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:456:9
|
||||
--> tests/ui/cast.rs:458:9
|
||||
|
|
||||
LL | (a / b) as u32;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:457:9
|
||||
--> tests/ui/cast.rs:459:9
|
||||
|
|
||||
LL | (a / b * c) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:459:9
|
||||
--> tests/ui/cast.rs:461:9
|
||||
|
|
||||
LL | (a / b + b * c) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:461:9
|
||||
--> tests/ui/cast.rs:463:9
|
||||
|
|
||||
LL | a.saturating_pow(3) as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:463:9
|
||||
--> tests/ui/cast.rs:465:9
|
||||
|
|
||||
LL | (a.abs() * b.pow(2) / c.abs()) as u32
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `u32` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:471:21
|
||||
--> tests/ui/cast.rs:473:21
|
||||
|
|
||||
LL | let _ = i32::MIN as u32; // cast_sign_loss
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -662,7 +662,7 @@ LL | m!();
|
||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: casting `u32` to `u8` may truncate the value
|
||||
--> tests/ui/cast.rs:472:21
|
||||
--> tests/ui/cast.rs:474:21
|
||||
|
|
||||
LL | let _ = u32::MAX as u8; // cast_possible_truncation
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -678,7 +678,7 @@ LL | let _ = u8::try_from(u32::MAX); // cast_possible_truncation
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `f64` to `f32` may truncate the value
|
||||
--> tests/ui/cast.rs:473:21
|
||||
--> tests/ui/cast.rs:475:21
|
||||
|
|
||||
LL | let _ = std::f64::consts::PI as f32; // cast_possible_truncation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -690,7 +690,7 @@ LL | m!();
|
||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast.rs:482:5
|
||||
--> tests/ui/cast.rs:484:5
|
||||
|
|
||||
LL | bar.unwrap().unwrap() as usize
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -702,13 +702,13 @@ LL | usize::try_from(bar.unwrap().unwrap())
|
||||
|
|
||||
|
||||
error: casting `i64` to `usize` may lose the sign of the value
|
||||
--> tests/ui/cast.rs:482:5
|
||||
--> tests/ui/cast.rs:484:5
|
||||
|
|
||||
LL | bar.unwrap().unwrap() as usize
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `u64` to `u8` may truncate the value
|
||||
--> tests/ui/cast.rs:497:5
|
||||
--> tests/ui/cast.rs:499:5
|
||||
|
|
||||
LL | (256 & 999999u64) as u8;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -720,7 +720,7 @@ LL | u8::try_from(256 & 999999u64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u64` to `u8` may truncate the value
|
||||
--> tests/ui/cast.rs:499:5
|
||||
--> tests/ui/cast.rs:501:5
|
||||
|
|
||||
LL | (255 % 999999u64) as u8;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,6 +1,8 @@
|
||||
#![allow(clippy::no_effect, clippy::unnecessary_operation, dead_code)]
|
||||
#![warn(clippy::cast_lossless)]
|
||||
|
||||
// FIXME(f16_f128): add tests for these types once const casting is available
|
||||
|
||||
type F32 = f32;
|
||||
type F64 = f64;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#![allow(clippy::no_effect, clippy::unnecessary_operation, dead_code)]
|
||||
#![warn(clippy::cast_lossless)]
|
||||
|
||||
// FIXME(f16_f128): add tests for these types once const casting is available
|
||||
|
||||
type F32 = f32;
|
||||
type F64 = f64;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: casting `i8` to `f32` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:10:13
|
||||
--> tests/ui/cast_lossless_float.rs:12:13
|
||||
|
|
||||
LL | let _ = x0 as f32;
|
||||
| ^^^^^^^^^ help: try: `f32::from(x0)`
|
||||
@ -8,73 +8,73 @@ LL | let _ = x0 as f32;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
|
||||
|
||||
error: casting `i8` to `f64` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:11:13
|
||||
--> tests/ui/cast_lossless_float.rs:13:13
|
||||
|
|
||||
LL | let _ = x0 as f64;
|
||||
| ^^^^^^^^^ help: try: `f64::from(x0)`
|
||||
|
||||
error: casting `i8` to `F32` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:12:13
|
||||
--> tests/ui/cast_lossless_float.rs:14:13
|
||||
|
|
||||
LL | let _ = x0 as F32;
|
||||
| ^^^^^^^^^ help: try: `F32::from(x0)`
|
||||
|
||||
error: casting `i8` to `F64` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:13:13
|
||||
--> tests/ui/cast_lossless_float.rs:15:13
|
||||
|
|
||||
LL | let _ = x0 as F64;
|
||||
| ^^^^^^^^^ help: try: `F64::from(x0)`
|
||||
|
||||
error: casting `u8` to `f32` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:15:13
|
||||
--> tests/ui/cast_lossless_float.rs:17:13
|
||||
|
|
||||
LL | let _ = x1 as f32;
|
||||
| ^^^^^^^^^ help: try: `f32::from(x1)`
|
||||
|
||||
error: casting `u8` to `f64` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:16:13
|
||||
--> tests/ui/cast_lossless_float.rs:18:13
|
||||
|
|
||||
LL | let _ = x1 as f64;
|
||||
| ^^^^^^^^^ help: try: `f64::from(x1)`
|
||||
|
||||
error: casting `i16` to `f32` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:18:13
|
||||
--> tests/ui/cast_lossless_float.rs:20:13
|
||||
|
|
||||
LL | let _ = x2 as f32;
|
||||
| ^^^^^^^^^ help: try: `f32::from(x2)`
|
||||
|
||||
error: casting `i16` to `f64` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:19:13
|
||||
--> tests/ui/cast_lossless_float.rs:21:13
|
||||
|
|
||||
LL | let _ = x2 as f64;
|
||||
| ^^^^^^^^^ help: try: `f64::from(x2)`
|
||||
|
||||
error: casting `u16` to `f32` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:21:13
|
||||
--> tests/ui/cast_lossless_float.rs:23:13
|
||||
|
|
||||
LL | let _ = x3 as f32;
|
||||
| ^^^^^^^^^ help: try: `f32::from(x3)`
|
||||
|
||||
error: casting `u16` to `f64` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:22:13
|
||||
--> tests/ui/cast_lossless_float.rs:24:13
|
||||
|
|
||||
LL | let _ = x3 as f64;
|
||||
| ^^^^^^^^^ help: try: `f64::from(x3)`
|
||||
|
||||
error: casting `i32` to `f64` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:24:13
|
||||
--> tests/ui/cast_lossless_float.rs:26:13
|
||||
|
|
||||
LL | let _ = x4 as f64;
|
||||
| ^^^^^^^^^ help: try: `f64::from(x4)`
|
||||
|
||||
error: casting `u32` to `f64` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:26:13
|
||||
--> tests/ui/cast_lossless_float.rs:28:13
|
||||
|
|
||||
LL | let _ = x5 as f64;
|
||||
| ^^^^^^^^^ help: try: `f64::from(x5)`
|
||||
|
||||
error: casting `f32` to `f64` may become silently lossy if you later change the type
|
||||
--> tests/ui/cast_lossless_float.rs:29:13
|
||||
--> tests/ui/cast_lossless_float.rs:31:13
|
||||
|
|
||||
LL | let _ = 1.0f32 as f64;
|
||||
| ^^^^^^^^^^^^^ help: try: `f64::from(1.0f32)`
|
||||
|
@ -1,3 +1,5 @@
|
||||
// FIXME(f16_f128): add tests when constants are available
|
||||
|
||||
#![warn(clippy::cast_nan_to_int)]
|
||||
#![allow(clippy::eq_op)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: casting a known NaN to usize
|
||||
--> tests/ui/cast_nan_to_int.rs:5:13
|
||||
--> tests/ui/cast_nan_to_int.rs:7:13
|
||||
|
|
||||
LL | let _ = (0.0_f32 / -0.0) as usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -9,7 +9,7 @@ LL | let _ = (0.0_f32 / -0.0) as usize;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_nan_to_int)]`
|
||||
|
||||
error: casting a known NaN to usize
|
||||
--> tests/ui/cast_nan_to_int.rs:8:13
|
||||
--> tests/ui/cast_nan_to_int.rs:10:13
|
||||
|
|
||||
LL | let _ = (f64::INFINITY * -0.0) as usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -17,7 +17,7 @@ LL | let _ = (f64::INFINITY * -0.0) as usize;
|
||||
= note: this always evaluates to 0
|
||||
|
||||
error: casting a known NaN to usize
|
||||
--> tests/ui/cast_nan_to_int.rs:11:13
|
||||
--> tests/ui/cast_nan_to_int.rs:13:13
|
||||
|
|
||||
LL | let _ = (0.0 * f32::INFINITY) as usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -25,7 +25,7 @@ LL | let _ = (0.0 * f32::INFINITY) as usize;
|
||||
= note: this always evaluates to 0
|
||||
|
||||
error: casting a known NaN to usize
|
||||
--> tests/ui/cast_nan_to_int.rs:15:13
|
||||
--> tests/ui/cast_nan_to_int.rs:17:13
|
||||
|
|
||||
LL | let _ = (f64::INFINITY + f64::NEG_INFINITY) as usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -33,7 +33,7 @@ LL | let _ = (f64::INFINITY + f64::NEG_INFINITY) as usize;
|
||||
= note: this always evaluates to 0
|
||||
|
||||
error: casting a known NaN to usize
|
||||
--> tests/ui/cast_nan_to_int.rs:18:13
|
||||
--> tests/ui/cast_nan_to_int.rs:20:13
|
||||
|
|
||||
LL | let _ = (f32::INFINITY - f32::INFINITY) as usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -41,7 +41,7 @@ LL | let _ = (f32::INFINITY - f32::INFINITY) as usize;
|
||||
= note: this always evaluates to 0
|
||||
|
||||
error: casting a known NaN to usize
|
||||
--> tests/ui/cast_nan_to_int.rs:21:13
|
||||
--> tests/ui/cast_nan_to_int.rs:23:13
|
||||
|
|
||||
LL | let _ = (f32::INFINITY / f32::NEG_INFINITY) as usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -12,35 +12,35 @@ help: ... or use `try_from` and handle the error accordingly
|
||||
LL | i8::try_from(1isize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `isize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`isize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:18:5
|
||||
error: casting `isize` to `f32` causes a loss of precision (`isize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast_size.rs:21:5
|
||||
|
|
||||
LL | x0 as f64;
|
||||
LL | x0 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
|
||||
|
||||
error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:19:5
|
||||
|
|
||||
LL | x1 as f64;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `isize` to `f32` causes a loss of precision (`isize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast_size.rs:20:5
|
||||
|
|
||||
LL | x0 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `usize` to `f32` causes a loss of precision (`usize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast_size.rs:21:5
|
||||
--> tests/ui/cast_size.rs:22:5
|
||||
|
|
||||
LL | x1 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `isize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`isize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:23:5
|
||||
|
|
||||
LL | x0 as f64;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:24:5
|
||||
|
|
||||
LL | x1 as f64;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `isize` to `i32` may truncate the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:22:5
|
||||
--> tests/ui/cast_size.rs:28:5
|
||||
|
|
||||
LL | 1isize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -52,7 +52,7 @@ LL | i32::try_from(1isize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:23:5
|
||||
--> tests/ui/cast_size.rs:29:5
|
||||
|
|
||||
LL | 1isize as u32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -64,7 +64,7 @@ LL | u32::try_from(1isize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:24:5
|
||||
--> tests/ui/cast_size.rs:30:5
|
||||
|
|
||||
LL | 1usize as u32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -76,7 +76,7 @@ LL | u32::try_from(1usize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:25:5
|
||||
--> tests/ui/cast_size.rs:31:5
|
||||
|
|
||||
LL | 1usize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -88,7 +88,7 @@ LL | i32::try_from(1usize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:25:5
|
||||
--> tests/ui/cast_size.rs:31:5
|
||||
|
|
||||
LL | 1usize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -97,7 +97,7 @@ LL | 1usize as i32;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
|
||||
|
||||
error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:26:5
|
||||
--> tests/ui/cast_size.rs:32:5
|
||||
|
|
||||
LL | 1i64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -109,7 +109,7 @@ LL | isize::try_from(1i64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:27:5
|
||||
--> tests/ui/cast_size.rs:33:5
|
||||
|
|
||||
LL | 1i64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -121,7 +121,7 @@ LL | usize::try_from(1i64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:28:5
|
||||
--> tests/ui/cast_size.rs:34:5
|
||||
|
|
||||
LL | 1u64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -133,13 +133,13 @@ LL | isize::try_from(1u64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:28:5
|
||||
--> tests/ui/cast_size.rs:34:5
|
||||
|
|
||||
LL | 1u64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:29:5
|
||||
--> tests/ui/cast_size.rs:35:5
|
||||
|
|
||||
LL | 1u64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -151,25 +151,25 @@ LL | usize::try_from(1u64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:30:5
|
||||
--> tests/ui/cast_size.rs:36:5
|
||||
|
|
||||
LL | 1u32 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast_size.rs:35:5
|
||||
--> tests/ui/cast_size.rs:43:5
|
||||
|
|
||||
LL | 999_999_999 as f32;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:36:5
|
||||
--> tests/ui/cast_size.rs:44:5
|
||||
|
|
||||
LL | 9_999_999_999_999_999usize as f64;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: literal out of range for `usize`
|
||||
--> tests/ui/cast_size.rs:36:5
|
||||
--> tests/ui/cast_size.rs:44:5
|
||||
|
|
||||
LL | 9_999_999_999_999_999usize as f64;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -12,35 +12,35 @@ help: ... or use `try_from` and handle the error accordingly
|
||||
LL | i8::try_from(1isize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `isize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`isize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:18:5
|
||||
error: casting `isize` to `f32` causes a loss of precision (`isize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast_size.rs:21:5
|
||||
|
|
||||
LL | x0 as f64;
|
||||
LL | x0 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
|
||||
|
||||
error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:19:5
|
||||
|
|
||||
LL | x1 as f64;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `isize` to `f32` causes a loss of precision (`isize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast_size.rs:20:5
|
||||
|
|
||||
LL | x0 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `usize` to `f32` causes a loss of precision (`usize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast_size.rs:21:5
|
||||
--> tests/ui/cast_size.rs:22:5
|
||||
|
|
||||
LL | x1 as f32;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `isize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`isize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:23:5
|
||||
|
|
||||
LL | x0 as f64;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:24:5
|
||||
|
|
||||
LL | x1 as f64;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: casting `isize` to `i32` may truncate the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:22:5
|
||||
--> tests/ui/cast_size.rs:28:5
|
||||
|
|
||||
LL | 1isize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -52,7 +52,7 @@ LL | i32::try_from(1isize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:23:5
|
||||
--> tests/ui/cast_size.rs:29:5
|
||||
|
|
||||
LL | 1isize as u32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -64,7 +64,7 @@ LL | u32::try_from(1isize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:24:5
|
||||
--> tests/ui/cast_size.rs:30:5
|
||||
|
|
||||
LL | 1usize as u32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -76,7 +76,7 @@ LL | u32::try_from(1usize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:25:5
|
||||
--> tests/ui/cast_size.rs:31:5
|
||||
|
|
||||
LL | 1usize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -88,7 +88,7 @@ LL | i32::try_from(1usize);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:25:5
|
||||
--> tests/ui/cast_size.rs:31:5
|
||||
|
|
||||
LL | 1usize as i32;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -97,7 +97,7 @@ LL | 1usize as i32;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
|
||||
|
||||
error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:26:5
|
||||
--> tests/ui/cast_size.rs:32:5
|
||||
|
|
||||
LL | 1i64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -109,7 +109,7 @@ LL | isize::try_from(1i64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:27:5
|
||||
--> tests/ui/cast_size.rs:33:5
|
||||
|
|
||||
LL | 1i64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -121,7 +121,7 @@ LL | usize::try_from(1i64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:28:5
|
||||
--> tests/ui/cast_size.rs:34:5
|
||||
|
|
||||
LL | 1u64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -133,13 +133,13 @@ LL | isize::try_from(1u64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:28:5
|
||||
--> tests/ui/cast_size.rs:34:5
|
||||
|
|
||||
LL | 1u64 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:29:5
|
||||
--> tests/ui/cast_size.rs:35:5
|
||||
|
|
||||
LL | 1u64 as usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
@ -151,19 +151,19 @@ LL | usize::try_from(1u64);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
|
||||
--> tests/ui/cast_size.rs:30:5
|
||||
--> tests/ui/cast_size.rs:36:5
|
||||
|
|
||||
LL | 1u32 as isize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> tests/ui/cast_size.rs:35:5
|
||||
--> tests/ui/cast_size.rs:43:5
|
||||
|
|
||||
LL | 999_999_999 as f32;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> tests/ui/cast_size.rs:36:5
|
||||
--> tests/ui/cast_size.rs:44:5
|
||||
|
|
||||
LL | 9_999_999_999_999_999usize as f64;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -15,10 +15,16 @@ fn main() {
|
||||
1isize as i8;
|
||||
let x0 = 1isize;
|
||||
let x1 = 1usize;
|
||||
x0 as f64;
|
||||
x1 as f64;
|
||||
// FIXME(f16_f128): enable f16 and f128 conversions once const eval supports them
|
||||
// x0 as f16;
|
||||
// x1 as f16;
|
||||
x0 as f32;
|
||||
x1 as f32;
|
||||
x0 as f64;
|
||||
x1 as f64;
|
||||
// x0 as f128;
|
||||
// x1 as f128;
|
||||
|
||||
1isize as i32;
|
||||
1isize as u32;
|
||||
1usize as u32;
|
||||
@ -31,7 +37,10 @@ fn main() {
|
||||
1u32 as usize; // Should not trigger any lint
|
||||
1i32 as isize; // Neither should this
|
||||
1i32 as usize;
|
||||
|
||||
// Big integer literal to float
|
||||
// 999_999 as f16;
|
||||
999_999_999 as f32;
|
||||
9_999_999_999_999_999usize as f64;
|
||||
// 999_999_999_999_999_999_999_999_999_999u128 as f128;
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> tests/ui/cfg_attr_cargo_clippy.rs:3:13
|
||||
|
|
||||
LL | #![cfg_attr(feature = "cargo-clippy", doc = "a")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
|
||||
= note: `-D clippy::deprecated-clippy-cfg-attr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::deprecated_clippy_cfg_attr)]`
|
||||
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> tests/ui/cfg_attr_cargo_clippy.rs:5:12
|
||||
|
|
||||
LL | #[cfg_attr(feature = "cargo-clippy", derive(Debug))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
|
||||
= note: `-D clippy::deprecated-clippy-cfg-attr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::deprecated_clippy_cfg_attr)]`
|
||||
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> tests/ui/cfg_attr_cargo_clippy.rs:6:16
|
||||
@ -37,11 +43,5 @@ error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
LL | #[cfg(all(feature = "cargo-clippy"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
||||
error: `feature = "cargo-clippy"` was replaced by `clippy`
|
||||
--> tests/ui/cfg_attr_cargo_clippy.rs:3:13
|
||||
|
|
||||
LL | #![cfg_attr(feature = "cargo-clippy", doc = "a")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `clippy`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@no-rustfix: overlapping suggestions
|
||||
#![feature(lint_reasons)]
|
||||
#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||||
#![allow(
|
||||
clippy::if_same_then_else,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: called `unwrap` on `x` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:47:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:46:9
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| -------------- help: try: `if let Some(..) = x`
|
||||
@ -8,13 +8,13 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:35
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:2:35
|
||||
|
|
||||
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `expect` on `x` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:50:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:49:9
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| -------------- help: try: `if let Some(..) = x`
|
||||
@ -23,7 +23,7 @@ LL | x.expect("an error message");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:54:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:53:9
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| ----------- because of this check
|
||||
@ -32,13 +32,13 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `expect()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:57:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:56:9
|
||||
|
|
||||
LL | if x.is_some() {
|
||||
| ----------- because of this check
|
||||
@ -47,7 +47,7 @@ LL | x.expect("an error message");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:62:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:61:9
|
||||
|
|
||||
LL | if x.is_none() {
|
||||
| ----------- because of this check
|
||||
@ -56,7 +56,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `x` after checking its variant with `is_none`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:66:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:65:9
|
||||
|
|
||||
LL | if x.is_none() {
|
||||
| -------------- help: try: `if let Some(..) = x`
|
||||
@ -65,7 +65,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `x` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:14:13
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:13:13
|
||||
|
|
||||
LL | if $a.is_some() {
|
||||
| --------------- help: try: `if let Some(..) = x`
|
||||
@ -79,7 +79,7 @@ LL | m!(x);
|
||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: called `unwrap` on `x` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:79:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:78:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| ------------ help: try: `if let Ok(..) = x`
|
||||
@ -88,7 +88,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: called `expect` on `x` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:82:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:81:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| ------------ help: try: `if let Ok(..) = x`
|
||||
@ -97,7 +97,7 @@ LL | x.expect("an error message");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap_err()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:85:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:84:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| --------- because of this check
|
||||
@ -106,7 +106,7 @@ LL | x.unwrap_err();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:89:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:88:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| --------- because of this check
|
||||
@ -115,7 +115,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: this call to `expect()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:92:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:91:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| --------- because of this check
|
||||
@ -124,7 +124,7 @@ LL | x.expect("an error message");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap_err` on `x` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:95:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:94:9
|
||||
|
|
||||
LL | if x.is_ok() {
|
||||
| ------------ help: try: `if let Err(..) = x`
|
||||
@ -133,7 +133,7 @@ LL | x.unwrap_err();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:100:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:99:9
|
||||
|
|
||||
LL | if x.is_err() {
|
||||
| ---------- because of this check
|
||||
@ -142,7 +142,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: called `unwrap_err` on `x` after checking its variant with `is_err`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:103:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:102:9
|
||||
|
|
||||
LL | if x.is_err() {
|
||||
| ------------- help: try: `if let Err(..) = x`
|
||||
@ -151,7 +151,7 @@ LL | x.unwrap_err();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `x` after checking its variant with `is_err`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:107:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:106:9
|
||||
|
|
||||
LL | if x.is_err() {
|
||||
| ------------- help: try: `if let Ok(..) = x`
|
||||
@ -160,7 +160,7 @@ LL | x.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap_err()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:110:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:109:9
|
||||
|
|
||||
LL | if x.is_err() {
|
||||
| ---------- because of this check
|
||||
@ -169,7 +169,7 @@ LL | x.unwrap_err();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `option` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:135:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:134:9
|
||||
|
|
||||
LL | if option.is_some() {
|
||||
| ------------------- help: try: `if let Some(..) = &option`
|
||||
@ -177,7 +177,7 @@ LL | option.as_ref().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:138:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:137:9
|
||||
|
|
||||
LL | if option.is_some() {
|
||||
| ---------------- because of this check
|
||||
@ -186,7 +186,7 @@ LL | option.as_ref().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:145:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:144:9
|
||||
|
|
||||
LL | if result.is_ok() {
|
||||
| ----------------- help: try: `if let Ok(..) = &result`
|
||||
@ -194,7 +194,7 @@ LL | result.as_ref().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:148:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:147:9
|
||||
|
|
||||
LL | if result.is_ok() {
|
||||
| -------------- because of this check
|
||||
@ -203,7 +203,7 @@ LL | result.as_ref().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `option` after checking its variant with `is_some`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:154:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:153:9
|
||||
|
|
||||
LL | if option.is_some() {
|
||||
| ------------------- help: try: `if let Some(..) = &mut option`
|
||||
@ -211,7 +211,7 @@ LL | option.as_mut().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:157:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:156:9
|
||||
|
|
||||
LL | if option.is_some() {
|
||||
| ---------------- because of this check
|
||||
@ -220,7 +220,7 @@ LL | option.as_mut().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:163:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:162:9
|
||||
|
|
||||
LL | if result.is_ok() {
|
||||
| ----------------- help: try: `if let Ok(..) = &mut result`
|
||||
@ -228,7 +228,7 @@ LL | result.as_mut().unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this call to `unwrap()` will always panic
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:166:9
|
||||
--> tests/ui/checked_unwrap/simple_conditionals.rs:165:9
|
||||
|
|
||||
LL | if result.is_ok() {
|
||||
| -------------- because of this check
|
||||
|
@ -4,9 +4,7 @@ error[E0412]: cannot find type `PhantomData` in this scope
|
||||
LL | _n: PhantomData,
|
||||
| ^^^^^^^^^^^ not found in this scope
|
||||
|
|
||||
help: consider importing one of these items
|
||||
|
|
||||
LL + use core::marker::PhantomData;
|
||||
help: consider importing this struct
|
||||
|
|
||||
LL + use std::marker::PhantomData;
|
||||
|
|
||||
|
@ -1,6 +1,5 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::default_numeric_fallback)]
|
||||
#![allow(
|
||||
unused,
|
||||
|
@ -1,6 +1,5 @@
|
||||
//@aux-build:proc_macros.rs
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::default_numeric_fallback)]
|
||||
#![allow(
|
||||
unused,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:21:17
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:20:17
|
||||
|
|
||||
LL | let x = 22;
|
||||
| ^^ help: consider adding suffix: `22_i32`
|
||||
@ -8,145 +8,145 @@ LL | let x = 22;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::default_numeric_fallback)]`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:18
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:21:18
|
||||
|
|
||||
LL | let x = [1, 2, 3];
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:21:21
|
||||
|
|
||||
LL | let x = [1, 2, 3];
|
||||
| ^ help: consider adding suffix: `2_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:24
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:21:24
|
||||
|
|
||||
LL | let x = [1, 2, 3];
|
||||
| ^ help: consider adding suffix: `3_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:28
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:28
|
||||
|
|
||||
LL | let x = if true { (1, 2) } else { (3, 4) };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:31
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:31
|
||||
|
|
||||
LL | let x = if true { (1, 2) } else { (3, 4) };
|
||||
| ^ help: consider adding suffix: `2_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:44
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:44
|
||||
|
|
||||
LL | let x = if true { (1, 2) } else { (3, 4) };
|
||||
| ^ help: consider adding suffix: `3_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:47
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:22:47
|
||||
|
|
||||
LL | let x = if true { (1, 2) } else { (3, 4) };
|
||||
| ^ help: consider adding suffix: `4_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:24:23
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:23:23
|
||||
|
|
||||
LL | let x = match 1 {
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:25:13
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:24:13
|
||||
|
|
||||
LL | 1 => 1,
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:25:18
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:24:18
|
||||
|
|
||||
LL | 1 => 1,
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:26:18
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:25:18
|
||||
|
|
||||
LL | _ => 2,
|
||||
| ^ help: consider adding suffix: `2_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:45:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:44:21
|
||||
|
|
||||
LL | let y = 1;
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:53:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:52:21
|
||||
|
|
||||
LL | let y = 1;
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:59:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:58:21
|
||||
|
|
||||
LL | let y = 1;
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:67:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:66:21
|
||||
|
|
||||
LL | let y = 1;
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:83:27
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:82:27
|
||||
|
|
||||
LL | let f = || -> _ { 1 };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:87:29
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:86:29
|
||||
|
|
||||
LL | let f = || -> i32 { 1 };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:101:21
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:100:21
|
||||
|
|
||||
LL | generic_arg(1);
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:104:32
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:103:32
|
||||
|
|
||||
LL | let x: _ = generic_arg(1);
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:122:28
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:121:28
|
||||
|
|
||||
LL | GenericStruct { x: 1 };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:125:36
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:124:36
|
||||
|
|
||||
LL | let _ = GenericStruct { x: 1 };
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:143:24
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:142:24
|
||||
|
|
||||
LL | GenericEnum::X(1);
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:163:23
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:162:23
|
||||
|
|
||||
LL | s.generic_arg(1);
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:173:25
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:172:25
|
||||
|
|
||||
LL | inline!(let x = 22;);
|
||||
| ^^ help: consider adding suffix: `22_i32`
|
||||
@ -154,19 +154,19 @@ LL | inline!(let x = 22;);
|
||||
= note: this error originates in the macro `__inline_mac_fn_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:215:29
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:214:29
|
||||
|
|
||||
LL | let data_i32 = vec![1, 2, 3];
|
||||
| ^ help: consider adding suffix: `1_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:215:32
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:214:32
|
||||
|
|
||||
LL | let data_i32 = vec![1, 2, 3];
|
||||
| ^ help: consider adding suffix: `2_i32`
|
||||
|
||||
error: default numeric fallback might occur
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:215:35
|
||||
--> tests/ui/default_numeric_fallback_i32.rs:214:35
|
||||
|
|
||||
LL | let data_i32 = vec![1, 2, 3];
|
||||
| ^ help: consider adding suffix: `3_i32`
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::derive_partial_eq_without_eq)]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::derive_partial_eq_without_eq)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:12:17
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:11:17
|
||||
|
|
||||
LL | #[derive(Debug, PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
@ -8,73 +8,73 @@ LL | #[derive(Debug, PartialEq)]
|
||||
= help: to override `-D warnings` add `#[allow(clippy::derive_partial_eq_without_eq)]`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:70:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:69:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:76:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:75:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:82:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:81:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:85:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:84:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:91:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:90:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:97:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:96:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:110:17
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:109:17
|
||||
|
|
||||
LL | #[derive(Debug, PartialEq, Clone)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:113:10
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:112:10
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:120:14
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:119:14
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:123:14
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:122:14
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:183:14
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:182:14
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
||||
error: you are deriving `PartialEq` and can implement `Eq`
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:191:14
|
||||
--> tests/ui/derive_partial_eq_without_eq.rs:190:14
|
||||
|
|
||||
LL | #[derive(PartialEq)]
|
||||
| ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
|
||||
|
@ -2,6 +2,8 @@
|
||||
#![allow(clippy::diverging_sub_expression)]
|
||||
#![no_main]
|
||||
|
||||
// FIXME(f16_f128): add these types when `{to_from}_*_bytes` are available
|
||||
|
||||
macro_rules! fn_body {
|
||||
() => {
|
||||
2u8.to_ne_bytes();
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: usage of the `u8::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:7:9
|
||||
--> tests/ui/endian_bytes.rs:9:9
|
||||
|
|
||||
LL | 2u8.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -13,7 +13,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i8::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:8:9
|
||||
--> tests/ui/endian_bytes.rs:10:9
|
||||
|
|
||||
LL | 2i8.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -25,7 +25,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u16::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:9:9
|
||||
--> tests/ui/endian_bytes.rs:11:9
|
||||
|
|
||||
LL | 2u16.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -37,7 +37,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i16::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:10:9
|
||||
--> tests/ui/endian_bytes.rs:12:9
|
||||
|
|
||||
LL | 2i16.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -49,7 +49,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u32::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:11:9
|
||||
--> tests/ui/endian_bytes.rs:13:9
|
||||
|
|
||||
LL | 2u32.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -61,7 +61,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i32::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:12:9
|
||||
--> tests/ui/endian_bytes.rs:14:9
|
||||
|
|
||||
LL | 2i32.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -73,7 +73,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u64::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:13:9
|
||||
--> tests/ui/endian_bytes.rs:15:9
|
||||
|
|
||||
LL | 2u64.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -85,7 +85,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i64::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:14:9
|
||||
--> tests/ui/endian_bytes.rs:16:9
|
||||
|
|
||||
LL | 2i64.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -97,7 +97,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u128::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:15:9
|
||||
--> tests/ui/endian_bytes.rs:17:9
|
||||
|
|
||||
LL | 2u128.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -109,7 +109,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i128::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:16:9
|
||||
--> tests/ui/endian_bytes.rs:18:9
|
||||
|
|
||||
LL | 2i128.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -121,7 +121,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `f32::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:17:9
|
||||
--> tests/ui/endian_bytes.rs:19:9
|
||||
|
|
||||
LL | 2.0f32.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -133,7 +133,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `f64::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:18:9
|
||||
--> tests/ui/endian_bytes.rs:20:9
|
||||
|
|
||||
LL | 2.0f64.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -145,7 +145,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `usize::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:19:9
|
||||
--> tests/ui/endian_bytes.rs:21:9
|
||||
|
|
||||
LL | 2usize.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -157,7 +157,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `isize::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:20:9
|
||||
--> tests/ui/endian_bytes.rs:22:9
|
||||
|
|
||||
LL | 2isize.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -169,7 +169,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:21:9
|
||||
--> tests/ui/endian_bytes.rs:23:9
|
||||
|
|
||||
LL | u8::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -181,7 +181,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i8::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:22:9
|
||||
--> tests/ui/endian_bytes.rs:24:9
|
||||
|
|
||||
LL | i8::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -193,7 +193,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u16::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:23:9
|
||||
--> tests/ui/endian_bytes.rs:25:9
|
||||
|
|
||||
LL | u16::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -205,7 +205,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i16::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:24:9
|
||||
--> tests/ui/endian_bytes.rs:26:9
|
||||
|
|
||||
LL | i16::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -217,7 +217,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u32::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:25:9
|
||||
--> tests/ui/endian_bytes.rs:27:9
|
||||
|
|
||||
LL | u32::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -229,7 +229,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i32::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:26:9
|
||||
--> tests/ui/endian_bytes.rs:28:9
|
||||
|
|
||||
LL | i32::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -241,7 +241,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u64::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:27:9
|
||||
--> tests/ui/endian_bytes.rs:29:9
|
||||
|
|
||||
LL | u64::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -253,7 +253,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i64::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:28:9
|
||||
--> tests/ui/endian_bytes.rs:30:9
|
||||
|
|
||||
LL | i64::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -265,7 +265,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u128::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:29:9
|
||||
--> tests/ui/endian_bytes.rs:31:9
|
||||
|
|
||||
LL | u128::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -277,7 +277,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i128::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:30:9
|
||||
--> tests/ui/endian_bytes.rs:32:9
|
||||
|
|
||||
LL | i128::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -289,7 +289,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `usize::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:31:9
|
||||
--> tests/ui/endian_bytes.rs:33:9
|
||||
|
|
||||
LL | usize::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -301,7 +301,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `isize::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:32:9
|
||||
--> tests/ui/endian_bytes.rs:34:9
|
||||
|
|
||||
LL | isize::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -313,7 +313,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `f32::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:33:9
|
||||
--> tests/ui/endian_bytes.rs:35:9
|
||||
|
|
||||
LL | f32::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -325,7 +325,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `f64::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:34:9
|
||||
--> tests/ui/endian_bytes.rs:36:9
|
||||
|
|
||||
LL | f64::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -337,7 +337,7 @@ LL | fn host() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:36:9
|
||||
--> tests/ui/endian_bytes.rs:38:9
|
||||
|
|
||||
LL | 2u8.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -351,7 +351,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i8::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:37:9
|
||||
--> tests/ui/endian_bytes.rs:39:9
|
||||
|
|
||||
LL | 2i8.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -363,7 +363,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u16::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:38:9
|
||||
--> tests/ui/endian_bytes.rs:40:9
|
||||
|
|
||||
LL | 2u16.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -375,7 +375,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i16::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:39:9
|
||||
--> tests/ui/endian_bytes.rs:41:9
|
||||
|
|
||||
LL | 2i16.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -387,7 +387,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u32::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:40:9
|
||||
--> tests/ui/endian_bytes.rs:42:9
|
||||
|
|
||||
LL | 2u32.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -399,7 +399,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i32::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:41:9
|
||||
--> tests/ui/endian_bytes.rs:43:9
|
||||
|
|
||||
LL | 2i32.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -411,7 +411,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u64::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:42:9
|
||||
--> tests/ui/endian_bytes.rs:44:9
|
||||
|
|
||||
LL | 2u64.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -423,7 +423,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i64::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:43:9
|
||||
--> tests/ui/endian_bytes.rs:45:9
|
||||
|
|
||||
LL | 2i64.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -435,7 +435,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u128::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:44:9
|
||||
--> tests/ui/endian_bytes.rs:46:9
|
||||
|
|
||||
LL | 2u128.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -447,7 +447,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `i128::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:45:9
|
||||
--> tests/ui/endian_bytes.rs:47:9
|
||||
|
|
||||
LL | 2i128.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
@ -459,7 +459,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `f32::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:46:9
|
||||
--> tests/ui/endian_bytes.rs:48:9
|
||||
|
|
||||
LL | 2.0f32.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -471,7 +471,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `f64::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:47:9
|
||||
--> tests/ui/endian_bytes.rs:49:9
|
||||
|
|
||||
LL | 2.0f64.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -483,7 +483,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `usize::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:48:9
|
||||
--> tests/ui/endian_bytes.rs:50:9
|
||||
|
|
||||
LL | 2usize.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -495,7 +495,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `isize::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:49:9
|
||||
--> tests/ui/endian_bytes.rs:51:9
|
||||
|
|
||||
LL | 2isize.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -507,7 +507,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:50:9
|
||||
--> tests/ui/endian_bytes.rs:52:9
|
||||
|
|
||||
LL | u8::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -519,7 +519,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i8::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:51:9
|
||||
--> tests/ui/endian_bytes.rs:53:9
|
||||
|
|
||||
LL | i8::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -531,7 +531,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u16::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:52:9
|
||||
--> tests/ui/endian_bytes.rs:54:9
|
||||
|
|
||||
LL | u16::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -543,7 +543,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i16::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:53:9
|
||||
--> tests/ui/endian_bytes.rs:55:9
|
||||
|
|
||||
LL | i16::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -555,7 +555,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u32::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:54:9
|
||||
--> tests/ui/endian_bytes.rs:56:9
|
||||
|
|
||||
LL | u32::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -567,7 +567,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i32::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:55:9
|
||||
--> tests/ui/endian_bytes.rs:57:9
|
||||
|
|
||||
LL | i32::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -579,7 +579,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u64::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:56:9
|
||||
--> tests/ui/endian_bytes.rs:58:9
|
||||
|
|
||||
LL | u64::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -591,7 +591,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i64::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:57:9
|
||||
--> tests/ui/endian_bytes.rs:59:9
|
||||
|
|
||||
LL | i64::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -603,7 +603,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u128::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:58:9
|
||||
--> tests/ui/endian_bytes.rs:60:9
|
||||
|
|
||||
LL | u128::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -615,7 +615,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `i128::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:59:9
|
||||
--> tests/ui/endian_bytes.rs:61:9
|
||||
|
|
||||
LL | i128::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -627,7 +627,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `usize::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:60:9
|
||||
--> tests/ui/endian_bytes.rs:62:9
|
||||
|
|
||||
LL | usize::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -639,7 +639,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `isize::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:61:9
|
||||
--> tests/ui/endian_bytes.rs:63:9
|
||||
|
|
||||
LL | isize::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -651,7 +651,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `f32::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:62:9
|
||||
--> tests/ui/endian_bytes.rs:64:9
|
||||
|
|
||||
LL | f32::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -663,7 +663,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `f64::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:63:9
|
||||
--> tests/ui/endian_bytes.rs:65:9
|
||||
|
|
||||
LL | f64::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -675,7 +675,7 @@ LL | fn little() { fn_body!(); }
|
||||
= note: this error originates in the macro `fn_body` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:70:9
|
||||
--> tests/ui/endian_bytes.rs:72:9
|
||||
|
|
||||
LL | 2u8.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -687,7 +687,7 @@ LL | fn host_encourage_little() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:71:9
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
|
|
||||
LL | u8::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -699,7 +699,7 @@ LL | fn host_encourage_little() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_be_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
--> tests/ui/endian_bytes.rs:78:9
|
||||
|
|
||||
LL | 2u8.to_be_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -713,7 +713,7 @@ LL | fn host_encourage_little() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_be_bytes`
|
||||
--> tests/ui/endian_bytes.rs:77:9
|
||||
--> tests/ui/endian_bytes.rs:79:9
|
||||
|
|
||||
LL | u8::from_be_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -725,7 +725,7 @@ LL | fn host_encourage_little() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:70:9
|
||||
--> tests/ui/endian_bytes.rs:72:9
|
||||
|
|
||||
LL | 2u8.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -737,7 +737,7 @@ LL | fn host_encourage_big() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:71:9
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
|
|
||||
LL | u8::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -749,7 +749,7 @@ LL | fn host_encourage_big() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
--> tests/ui/endian_bytes.rs:75:9
|
||||
|
|
||||
LL | 2u8.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -761,7 +761,7 @@ LL | fn host_encourage_big() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:74:9
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
|
|
||||
LL | u8::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -773,7 +773,7 @@ LL | fn host_encourage_big() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:70:9
|
||||
--> tests/ui/endian_bytes.rs:72:9
|
||||
|
|
||||
LL | 2u8.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -784,7 +784,7 @@ LL | fn no_help() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:71:9
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
|
|
||||
LL | u8::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -795,7 +795,7 @@ LL | fn no_help() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
--> tests/ui/endian_bytes.rs:75:9
|
||||
|
|
||||
LL | 2u8.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -806,7 +806,7 @@ LL | fn no_help() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:74:9
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
|
|
||||
LL | u8::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -817,7 +817,7 @@ LL | fn no_help() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_be_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
--> tests/ui/endian_bytes.rs:78:9
|
||||
|
|
||||
LL | 2u8.to_be_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -828,7 +828,7 @@ LL | fn no_help() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_be_bytes`
|
||||
--> tests/ui/endian_bytes.rs:77:9
|
||||
--> tests/ui/endian_bytes.rs:79:9
|
||||
|
|
||||
LL | u8::from_be_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -839,7 +839,7 @@ LL | fn no_help() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
--> tests/ui/endian_bytes.rs:75:9
|
||||
|
|
||||
LL | 2u8.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -851,7 +851,7 @@ LL | fn little_encourage_host() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:74:9
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
|
|
||||
LL | u8::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -863,7 +863,7 @@ LL | fn little_encourage_host() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_be_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
--> tests/ui/endian_bytes.rs:78:9
|
||||
|
|
||||
LL | 2u8.to_be_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -875,7 +875,7 @@ LL | fn little_encourage_host() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_be_bytes`
|
||||
--> tests/ui/endian_bytes.rs:77:9
|
||||
--> tests/ui/endian_bytes.rs:79:9
|
||||
|
|
||||
LL | u8::from_be_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -887,7 +887,7 @@ LL | fn little_encourage_host() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:70:9
|
||||
--> tests/ui/endian_bytes.rs:72:9
|
||||
|
|
||||
LL | 2u8.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -899,7 +899,7 @@ LL | fn little_encourage_big() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:71:9
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
|
|
||||
LL | u8::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -911,7 +911,7 @@ LL | fn little_encourage_big() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
--> tests/ui/endian_bytes.rs:75:9
|
||||
|
|
||||
LL | 2u8.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -923,7 +923,7 @@ LL | fn little_encourage_big() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:74:9
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
|
|
||||
LL | u8::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -935,7 +935,7 @@ LL | fn little_encourage_big() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_le_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
--> tests/ui/endian_bytes.rs:75:9
|
||||
|
|
||||
LL | 2u8.to_le_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -947,7 +947,7 @@ LL | fn big_encourage_host() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_le_bytes`
|
||||
--> tests/ui/endian_bytes.rs:74:9
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
|
|
||||
LL | u8::from_le_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -959,7 +959,7 @@ LL | fn big_encourage_host() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_be_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
--> tests/ui/endian_bytes.rs:78:9
|
||||
|
|
||||
LL | 2u8.to_be_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -971,7 +971,7 @@ LL | fn big_encourage_host() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_be_bytes`
|
||||
--> tests/ui/endian_bytes.rs:77:9
|
||||
--> tests/ui/endian_bytes.rs:79:9
|
||||
|
|
||||
LL | u8::from_be_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -983,7 +983,7 @@ LL | fn big_encourage_host() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_ne_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:70:9
|
||||
--> tests/ui/endian_bytes.rs:72:9
|
||||
|
|
||||
LL | 2u8.to_ne_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -995,7 +995,7 @@ LL | fn big_encourage_little() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_ne_bytes`
|
||||
--> tests/ui/endian_bytes.rs:71:9
|
||||
--> tests/ui/endian_bytes.rs:73:9
|
||||
|
|
||||
LL | u8::from_ne_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -1007,7 +1007,7 @@ LL | fn big_encourage_little() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the `u8::to_be_bytes` method
|
||||
--> tests/ui/endian_bytes.rs:76:9
|
||||
--> tests/ui/endian_bytes.rs:78:9
|
||||
|
|
||||
LL | 2u8.to_be_bytes();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -1019,7 +1019,7 @@ LL | fn big_encourage_little() { fn_body_smol!(); }
|
||||
= note: this error originates in the macro `fn_body_smol` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: usage of the function `u8::from_be_bytes`
|
||||
--> tests/ui/endian_bytes.rs:77:9
|
||||
--> tests/ui/endian_bytes.rs:79:9
|
||||
|
|
||||
LL | u8::from_be_bytes(todo!());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
//! This file tests the `#[expect]` attribute implementation for tool lints. The same
|
||||
//! file is used to test clippy and rustdoc. Any changes to this file should be synced
|
||||
//! to the other test files as well.
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:31:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:30:14
|
||||
|
|
||||
LL | #[expect(dead_code)]
|
||||
| ^^^^^^^^^
|
||||
@ -8,31 +8,31 @@ LL | #[expect(dead_code)]
|
||||
= help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]`
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:37:18
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:36:18
|
||||
|
|
||||
LL | #[expect(invalid_nan_comparisons)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:108:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:107:14
|
||||
|
|
||||
LL | #[expect(clippy::almost_swapped)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:116:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:115:14
|
||||
|
|
||||
LL | #[expect(clippy::bytes_nth)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:122:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:121:14
|
||||
|
|
||||
LL | #[expect(clippy::if_same_then_else)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this lint expectation is unfulfilled
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:128:14
|
||||
--> tests/ui/expect_tool_lint_rfc_2383.rs:127:14
|
||||
|
|
||||
LL | #[expect(clippy::overly_complex_bool_expr)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,3 +1,5 @@
|
||||
// FIXME(f16_f128): const casting is not yet supported for these types. Add when available.
|
||||
|
||||
#![warn(clippy::float_cmp)]
|
||||
#![allow(
|
||||
unused,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: strict comparison of `f32` or `f64`
|
||||
--> tests/ui/float_cmp.rs:70:5
|
||||
--> tests/ui/float_cmp.rs:72:5
|
||||
|
|
||||
LL | ONE as f64 != 2.0;
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(ONE as f64 - 2.0).abs() > error_margin`
|
||||
@ -9,7 +9,7 @@ LL | ONE as f64 != 2.0;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::float_cmp)]`
|
||||
|
||||
error: strict comparison of `f32` or `f64`
|
||||
--> tests/ui/float_cmp.rs:77:5
|
||||
--> tests/ui/float_cmp.rs:79:5
|
||||
|
|
||||
LL | x == 1.0;
|
||||
| ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 1.0).abs() < error_margin`
|
||||
@ -17,7 +17,7 @@ LL | x == 1.0;
|
||||
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
|
||||
|
||||
error: strict comparison of `f32` or `f64`
|
||||
--> tests/ui/float_cmp.rs:82:5
|
||||
--> tests/ui/float_cmp.rs:84:5
|
||||
|
|
||||
LL | twice(x) != twice(ONE as f64);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(twice(x) - twice(ONE as f64)).abs() > error_margin`
|
||||
@ -25,7 +25,7 @@ LL | twice(x) != twice(ONE as f64);
|
||||
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
|
||||
|
||||
error: strict comparison of `f32` or `f64`
|
||||
--> tests/ui/float_cmp.rs:104:5
|
||||
--> tests/ui/float_cmp.rs:106:5
|
||||
|
|
||||
LL | NON_ZERO_ARRAY[i] == NON_ZERO_ARRAY[j];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(NON_ZERO_ARRAY[i] - NON_ZERO_ARRAY[j]).abs() < error_margin`
|
||||
@ -33,7 +33,7 @@ LL | NON_ZERO_ARRAY[i] == NON_ZERO_ARRAY[j];
|
||||
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
|
||||
|
||||
error: strict comparison of `f32` or `f64` arrays
|
||||
--> tests/ui/float_cmp.rs:111:5
|
||||
--> tests/ui/float_cmp.rs:113:5
|
||||
|
|
||||
LL | a1 == a2;
|
||||
| ^^^^^^^^
|
||||
@ -41,7 +41,7 @@ LL | a1 == a2;
|
||||
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
|
||||
|
||||
error: strict comparison of `f32` or `f64`
|
||||
--> tests/ui/float_cmp.rs:114:5
|
||||
--> tests/ui/float_cmp.rs:116:5
|
||||
|
|
||||
LL | a1[0] == a2[0];
|
||||
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(a1[0] - a2[0]).abs() < error_margin`
|
||||
|
@ -1,5 +1,8 @@
|
||||
#![warn(clippy::float_equality_without_abs)]
|
||||
//@no-rustfix
|
||||
|
||||
// FIXME(f16_f128): add tests for these types when abs is available
|
||||
|
||||
pub fn is_roughly_equal(a: f32, b: f32) -> bool {
|
||||
(a - b) < f32::EPSILON
|
||||
//~^ ERROR: float equality check without `.abs()`
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:4:5
|
||||
--> tests/ui/float_equality_without_abs.rs:7:5
|
||||
|
|
||||
LL | (a - b) < f32::EPSILON
|
||||
| -------^^^^^^^^^^^^^^^
|
||||
@ -10,7 +10,7 @@ LL | (a - b) < f32::EPSILON
|
||||
= help: to override `-D warnings` add `#[allow(clippy::float_equality_without_abs)]`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:15:13
|
||||
--> tests/ui/float_equality_without_abs.rs:18:13
|
||||
|
|
||||
LL | let _ = (a - b) < f32::EPSILON;
|
||||
| -------^^^^^^^^^^^^^^^
|
||||
@ -18,7 +18,7 @@ LL | let _ = (a - b) < f32::EPSILON;
|
||||
| help: add `.abs()`: `(a - b).abs()`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:17:13
|
||||
--> tests/ui/float_equality_without_abs.rs:20:13
|
||||
|
|
||||
LL | let _ = a - b < f32::EPSILON;
|
||||
| -----^^^^^^^^^^^^^^^
|
||||
@ -26,7 +26,7 @@ LL | let _ = a - b < f32::EPSILON;
|
||||
| help: add `.abs()`: `(a - b).abs()`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:19:13
|
||||
--> tests/ui/float_equality_without_abs.rs:22:13
|
||||
|
|
||||
LL | let _ = a - b.abs() < f32::EPSILON;
|
||||
| -----------^^^^^^^^^^^^^^^
|
||||
@ -34,7 +34,7 @@ LL | let _ = a - b.abs() < f32::EPSILON;
|
||||
| help: add `.abs()`: `(a - b.abs()).abs()`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:21:13
|
||||
--> tests/ui/float_equality_without_abs.rs:24:13
|
||||
|
|
||||
LL | let _ = (a as f64 - b as f64) < f64::EPSILON;
|
||||
| ---------------------^^^^^^^^^^^^^^^
|
||||
@ -42,7 +42,7 @@ LL | let _ = (a as f64 - b as f64) < f64::EPSILON;
|
||||
| help: add `.abs()`: `(a as f64 - b as f64).abs()`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:23:13
|
||||
--> tests/ui/float_equality_without_abs.rs:26:13
|
||||
|
|
||||
LL | let _ = 1.0 - 2.0 < f32::EPSILON;
|
||||
| ---------^^^^^^^^^^^^^^^
|
||||
@ -50,7 +50,7 @@ LL | let _ = 1.0 - 2.0 < f32::EPSILON;
|
||||
| help: add `.abs()`: `(1.0 - 2.0).abs()`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:26:13
|
||||
--> tests/ui/float_equality_without_abs.rs:29:13
|
||||
|
|
||||
LL | let _ = f32::EPSILON > (a - b);
|
||||
| ^^^^^^^^^^^^^^^-------
|
||||
@ -58,7 +58,7 @@ LL | let _ = f32::EPSILON > (a - b);
|
||||
| help: add `.abs()`: `(a - b).abs()`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:28:13
|
||||
--> tests/ui/float_equality_without_abs.rs:31:13
|
||||
|
|
||||
LL | let _ = f32::EPSILON > a - b;
|
||||
| ^^^^^^^^^^^^^^^-----
|
||||
@ -66,7 +66,7 @@ LL | let _ = f32::EPSILON > a - b;
|
||||
| help: add `.abs()`: `(a - b).abs()`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:30:13
|
||||
--> tests/ui/float_equality_without_abs.rs:33:13
|
||||
|
|
||||
LL | let _ = f32::EPSILON > a - b.abs();
|
||||
| ^^^^^^^^^^^^^^^-----------
|
||||
@ -74,7 +74,7 @@ LL | let _ = f32::EPSILON > a - b.abs();
|
||||
| help: add `.abs()`: `(a - b.abs()).abs()`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:32:13
|
||||
--> tests/ui/float_equality_without_abs.rs:35:13
|
||||
|
|
||||
LL | let _ = f64::EPSILON > (a as f64 - b as f64);
|
||||
| ^^^^^^^^^^^^^^^---------------------
|
||||
@ -82,7 +82,7 @@ LL | let _ = f64::EPSILON > (a as f64 - b as f64);
|
||||
| help: add `.abs()`: `(a as f64 - b as f64).abs()`
|
||||
|
||||
error: float equality check without `.abs()`
|
||||
--> tests/ui/float_equality_without_abs.rs:34:13
|
||||
--> tests/ui/float_equality_without_abs.rs:37:13
|
||||
|
|
||||
LL | let _ = f32::EPSILON > 1.0 - 2.0;
|
||||
| ^^^^^^^^^^^^^^^---------
|
||||
|
@ -3,8 +3,8 @@
|
||||
#![warn(clippy::suboptimal_flops)]
|
||||
#![no_std]
|
||||
|
||||
// The following should not lint, as the suggested methods {f32,f64}.mul_add()
|
||||
// and {f32,f64}::abs() are not available in no_std
|
||||
// The following should not lint, as the suggested methods `{f16,f32,f64,f128}.mul_add()`
|
||||
// and ``{f16,f32,f64,f128}::abs()` are not available in no_std
|
||||
|
||||
pub fn mul_add() {
|
||||
let a: f64 = 1234.567;
|
||||
|
@ -1,3 +1,5 @@
|
||||
// FIXME(f16_f128): add tests when exp is available
|
||||
|
||||
#![warn(clippy::imprecise_flops)]
|
||||
#![allow(clippy::unnecessary_cast)]
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
// FIXME(f16_f128): add tests when exp is available
|
||||
|
||||
#![warn(clippy::imprecise_flops)]
|
||||
#![allow(clippy::unnecessary_cast)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: (e.pow(x) - 1) can be computed more accurately
|
||||
--> tests/ui/floating_point_exp.rs:6:13
|
||||
--> tests/ui/floating_point_exp.rs:8:13
|
||||
|
|
||||
LL | let _ = x.exp() - 1.0;
|
||||
| ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
|
||||
@ -8,25 +8,25 @@ LL | let _ = x.exp() - 1.0;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::imprecise_flops)]`
|
||||
|
||||
error: (e.pow(x) - 1) can be computed more accurately
|
||||
--> tests/ui/floating_point_exp.rs:7:13
|
||||
--> tests/ui/floating_point_exp.rs:9:13
|
||||
|
|
||||
LL | let _ = x.exp() - 1.0 + 2.0;
|
||||
| ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
|
||||
|
||||
error: (e.pow(x) - 1) can be computed more accurately
|
||||
--> tests/ui/floating_point_exp.rs:8:13
|
||||
--> tests/ui/floating_point_exp.rs:10:13
|
||||
|
|
||||
LL | let _ = (x as f32).exp() - 1.0 + 2.0;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).exp_m1()`
|
||||
|
||||
error: (e.pow(x) - 1) can be computed more accurately
|
||||
--> tests/ui/floating_point_exp.rs:14:13
|
||||
--> tests/ui/floating_point_exp.rs:16:13
|
||||
|
|
||||
LL | let _ = x.exp() - 1.0;
|
||||
| ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
|
||||
|
||||
error: (e.pow(x) - 1) can be computed more accurately
|
||||
--> tests/ui/floating_point_exp.rs:15:13
|
||||
--> tests/ui/floating_point_exp.rs:17:13
|
||||
|
|
||||
LL | let _ = x.exp() - 1.0 + 2.0;
|
||||
| ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
|
||||
|
@ -1,6 +1,8 @@
|
||||
#![allow(dead_code, clippy::double_parens, clippy::unnecessary_cast)]
|
||||
#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
|
||||
|
||||
// FIXME(f16_f128): add tests for these types once math functions are available
|
||||
|
||||
const TWO: f32 = 2.0;
|
||||
const E: f32 = std::f32::consts::E;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#![allow(dead_code, clippy::double_parens, clippy::unnecessary_cast)]
|
||||
#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
|
||||
|
||||
// FIXME(f16_f128): add tests for these types once math functions are available
|
||||
|
||||
const TWO: f32 = 2.0;
|
||||
const E: f32 = std::f32::consts::E;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: logarithm for bases 2, 10 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:9:13
|
||||
--> tests/ui/floating_point_log.rs:11:13
|
||||
|
|
||||
LL | let _ = x.log(2f32);
|
||||
| ^^^^^^^^^^^ help: consider using: `x.log2()`
|
||||
@ -8,55 +8,55 @@ LL | let _ = x.log(2f32);
|
||||
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
|
||||
|
||||
error: logarithm for bases 2, 10 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:10:13
|
||||
--> tests/ui/floating_point_log.rs:12:13
|
||||
|
|
||||
LL | let _ = x.log(10f32);
|
||||
| ^^^^^^^^^^^^ help: consider using: `x.log10()`
|
||||
|
||||
error: logarithm for bases 2, 10 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:11:13
|
||||
--> tests/ui/floating_point_log.rs:13:13
|
||||
|
|
||||
LL | let _ = x.log(std::f32::consts::E);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.ln()`
|
||||
|
||||
error: logarithm for bases 2, 10 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:12:13
|
||||
--> tests/ui/floating_point_log.rs:14:13
|
||||
|
|
||||
LL | let _ = x.log(TWO);
|
||||
| ^^^^^^^^^^ help: consider using: `x.log2()`
|
||||
|
||||
error: logarithm for bases 2, 10 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:13:13
|
||||
--> tests/ui/floating_point_log.rs:15:13
|
||||
|
|
||||
LL | let _ = x.log(E);
|
||||
| ^^^^^^^^ help: consider using: `x.ln()`
|
||||
|
||||
error: logarithm for bases 2, 10 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:14:13
|
||||
--> tests/ui/floating_point_log.rs:16:13
|
||||
|
|
||||
LL | let _ = (x as f32).log(2f32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).log2()`
|
||||
|
||||
error: logarithm for bases 2, 10 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:17:13
|
||||
--> tests/ui/floating_point_log.rs:19:13
|
||||
|
|
||||
LL | let _ = x.log(2f64);
|
||||
| ^^^^^^^^^^^ help: consider using: `x.log2()`
|
||||
|
||||
error: logarithm for bases 2, 10 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:18:13
|
||||
--> tests/ui/floating_point_log.rs:20:13
|
||||
|
|
||||
LL | let _ = x.log(10f64);
|
||||
| ^^^^^^^^^^^^ help: consider using: `x.log10()`
|
||||
|
||||
error: logarithm for bases 2, 10 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:19:13
|
||||
--> tests/ui/floating_point_log.rs:21:13
|
||||
|
|
||||
LL | let _ = x.log(std::f64::consts::E);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.ln()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:24:13
|
||||
--> tests/ui/floating_point_log.rs:26:13
|
||||
|
|
||||
LL | let _ = (1f32 + 2.).ln();
|
||||
| ^^^^^^^^^^^^^^^^ help: consider using: `2.0f32.ln_1p()`
|
||||
@ -65,115 +65,115 @@ LL | let _ = (1f32 + 2.).ln();
|
||||
= help: to override `-D warnings` add `#[allow(clippy::imprecise_flops)]`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:25:13
|
||||
--> tests/ui/floating_point_log.rs:27:13
|
||||
|
|
||||
LL | let _ = (1f32 + 2.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider using: `2.0f32.ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:26:13
|
||||
--> tests/ui/floating_point_log.rs:28:13
|
||||
|
|
||||
LL | let _ = (1.0 + x).ln();
|
||||
| ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:27:13
|
||||
--> tests/ui/floating_point_log.rs:29:13
|
||||
|
|
||||
LL | let _ = (1.0 + x / 2.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x / 2.0).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:28:13
|
||||
--> tests/ui/floating_point_log.rs:30:13
|
||||
|
|
||||
LL | let _ = (1.0 + x.powi(3)).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(3).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:29:13
|
||||
--> tests/ui/floating_point_log.rs:31:13
|
||||
|
|
||||
LL | let _ = (1.0 + x.powi(3) / 2.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x.powi(3) / 2.0).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:30:13
|
||||
--> tests/ui/floating_point_log.rs:32:13
|
||||
|
|
||||
LL | let _ = (1.0 + (std::f32::consts::E - 1.0)).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(std::f32::consts::E - 1.0).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:31:13
|
||||
--> tests/ui/floating_point_log.rs:33:13
|
||||
|
|
||||
LL | let _ = (x + 1.0).ln();
|
||||
| ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:32:13
|
||||
--> tests/ui/floating_point_log.rs:34:13
|
||||
|
|
||||
LL | let _ = (x.powi(3) + 1.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(3).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:33:13
|
||||
--> tests/ui/floating_point_log.rs:35:13
|
||||
|
|
||||
LL | let _ = (x + 2.0 + 1.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x + 2.0).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:34:13
|
||||
--> tests/ui/floating_point_log.rs:36:13
|
||||
|
|
||||
LL | let _ = (x / 2.0 + 1.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x / 2.0).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:42:13
|
||||
--> tests/ui/floating_point_log.rs:44:13
|
||||
|
|
||||
LL | let _ = (1f64 + 2.).ln();
|
||||
| ^^^^^^^^^^^^^^^^ help: consider using: `2.0f64.ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:43:13
|
||||
--> tests/ui/floating_point_log.rs:45:13
|
||||
|
|
||||
LL | let _ = (1f64 + 2.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider using: `2.0f64.ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:44:13
|
||||
--> tests/ui/floating_point_log.rs:46:13
|
||||
|
|
||||
LL | let _ = (1.0 + x).ln();
|
||||
| ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:45:13
|
||||
--> tests/ui/floating_point_log.rs:47:13
|
||||
|
|
||||
LL | let _ = (1.0 + x / 2.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x / 2.0).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:46:13
|
||||
--> tests/ui/floating_point_log.rs:48:13
|
||||
|
|
||||
LL | let _ = (1.0 + x.powi(3)).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(3).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:47:13
|
||||
--> tests/ui/floating_point_log.rs:49:13
|
||||
|
|
||||
LL | let _ = (x + 1.0).ln();
|
||||
| ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:48:13
|
||||
--> tests/ui/floating_point_log.rs:50:13
|
||||
|
|
||||
LL | let _ = (x.powi(3) + 1.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(3).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:49:13
|
||||
--> tests/ui/floating_point_log.rs:51:13
|
||||
|
|
||||
LL | let _ = (x + 2.0 + 1.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x + 2.0).ln_1p()`
|
||||
|
||||
error: ln(1 + x) can be computed more accurately
|
||||
--> tests/ui/floating_point_log.rs:50:13
|
||||
--> tests/ui/floating_point_log.rs:52:13
|
||||
|
|
||||
LL | let _ = (x / 2.0 + 1.0).ln();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x / 2.0).ln_1p()`
|
||||
|
@ -1,6 +1,8 @@
|
||||
#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
|
||||
#![allow(clippy::unnecessary_cast)]
|
||||
|
||||
// FIXME(f16_f128): add tests for these types when `powf` is available
|
||||
|
||||
fn main() {
|
||||
let x = 3f32;
|
||||
let _ = x.exp2();
|
||||
|
@ -1,6 +1,8 @@
|
||||
#![warn(clippy::suboptimal_flops, clippy::imprecise_flops)]
|
||||
#![allow(clippy::unnecessary_cast)]
|
||||
|
||||
// FIXME(f16_f128): add tests for these types when `powf` is available
|
||||
|
||||
fn main() {
|
||||
let x = 3f32;
|
||||
let _ = 2f32.powf(x);
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:6:13
|
||||
--> tests/ui/floating_point_powf.rs:8:13
|
||||
|
|
||||
LL | let _ = 2f32.powf(x);
|
||||
| ^^^^^^^^^^^^ help: consider using: `x.exp2()`
|
||||
@ -8,43 +8,43 @@ LL | let _ = 2f32.powf(x);
|
||||
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:7:13
|
||||
--> tests/ui/floating_point_powf.rs:9:13
|
||||
|
|
||||
LL | let _ = 2f32.powf(3.1);
|
||||
| ^^^^^^^^^^^^^^ help: consider using: `3.1f32.exp2()`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:8:13
|
||||
--> tests/ui/floating_point_powf.rs:10:13
|
||||
|
|
||||
LL | let _ = 2f32.powf(-3.1);
|
||||
| ^^^^^^^^^^^^^^^ help: consider using: `(-3.1f32).exp2()`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:9:13
|
||||
--> tests/ui/floating_point_powf.rs:11:13
|
||||
|
|
||||
LL | let _ = std::f32::consts::E.powf(x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.exp()`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:10:13
|
||||
--> tests/ui/floating_point_powf.rs:12:13
|
||||
|
|
||||
LL | let _ = std::f32::consts::E.powf(3.1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `3.1f32.exp()`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:11:13
|
||||
--> tests/ui/floating_point_powf.rs:13:13
|
||||
|
|
||||
LL | let _ = std::f32::consts::E.powf(-3.1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-3.1f32).exp()`
|
||||
|
||||
error: square-root of a number can be computed more efficiently and accurately
|
||||
--> tests/ui/floating_point_powf.rs:12:13
|
||||
--> tests/ui/floating_point_powf.rs:14:13
|
||||
|
|
||||
LL | let _ = x.powf(1.0 / 2.0);
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider using: `x.sqrt()`
|
||||
|
||||
error: cube-root of a number can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:13:13
|
||||
--> tests/ui/floating_point_powf.rs:15:13
|
||||
|
|
||||
LL | let _ = x.powf(1.0 / 3.0);
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider using: `x.cbrt()`
|
||||
@ -53,139 +53,139 @@ LL | let _ = x.powf(1.0 / 3.0);
|
||||
= help: to override `-D warnings` add `#[allow(clippy::imprecise_flops)]`
|
||||
|
||||
error: cube-root of a number can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:14:13
|
||||
--> tests/ui/floating_point_powf.rs:16:13
|
||||
|
|
||||
LL | let _ = (x as f32).powf(1.0 / 3.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).cbrt()`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:15:13
|
||||
--> tests/ui/floating_point_powf.rs:17:13
|
||||
|
|
||||
LL | let _ = x.powf(3.0);
|
||||
| ^^^^^^^^^^^ help: consider using: `x.powi(3)`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:16:13
|
||||
--> tests/ui/floating_point_powf.rs:18:13
|
||||
|
|
||||
LL | let _ = x.powf(-2.0);
|
||||
| ^^^^^^^^^^^^ help: consider using: `x.powi(-2)`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:17:13
|
||||
--> tests/ui/floating_point_powf.rs:19:13
|
||||
|
|
||||
LL | let _ = x.powf(16_777_215.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(16_777_215)`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:18:13
|
||||
--> tests/ui/floating_point_powf.rs:20:13
|
||||
|
|
||||
LL | let _ = x.powf(-16_777_215.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(-16_777_215)`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:19:13
|
||||
--> tests/ui/floating_point_powf.rs:21:13
|
||||
|
|
||||
LL | let _ = (x as f32).powf(-16_777_215.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).powi(-16_777_215)`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:20:13
|
||||
--> tests/ui/floating_point_powf.rs:22:13
|
||||
|
|
||||
LL | let _ = (x as f32).powf(3.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x as f32).powi(3)`
|
||||
|
||||
error: cube-root of a number can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:21:13
|
||||
--> tests/ui/floating_point_powf.rs:23:13
|
||||
|
|
||||
LL | let _ = (1.5_f32 + 1.0).powf(1.0 / 3.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(1.5_f32 + 1.0).cbrt()`
|
||||
|
||||
error: cube-root of a number can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:22:13
|
||||
--> tests/ui/floating_point_powf.rs:24:13
|
||||
|
|
||||
LL | let _ = 1.5_f64.powf(1.0 / 3.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1.5_f64.cbrt()`
|
||||
|
||||
error: square-root of a number can be computed more efficiently and accurately
|
||||
--> tests/ui/floating_point_powf.rs:23:13
|
||||
--> tests/ui/floating_point_powf.rs:25:13
|
||||
|
|
||||
LL | let _ = 1.5_f64.powf(1.0 / 2.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1.5_f64.sqrt()`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:24:13
|
||||
--> tests/ui/floating_point_powf.rs:26:13
|
||||
|
|
||||
LL | let _ = 1.5_f64.powf(3.0);
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider using: `1.5_f64.powi(3)`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:33:13
|
||||
--> tests/ui/floating_point_powf.rs:35:13
|
||||
|
|
||||
LL | let _ = 2f64.powf(x);
|
||||
| ^^^^^^^^^^^^ help: consider using: `x.exp2()`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:34:13
|
||||
--> tests/ui/floating_point_powf.rs:36:13
|
||||
|
|
||||
LL | let _ = 2f64.powf(3.1);
|
||||
| ^^^^^^^^^^^^^^ help: consider using: `3.1f64.exp2()`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:35:13
|
||||
--> tests/ui/floating_point_powf.rs:37:13
|
||||
|
|
||||
LL | let _ = 2f64.powf(-3.1);
|
||||
| ^^^^^^^^^^^^^^^ help: consider using: `(-3.1f64).exp2()`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:36:13
|
||||
--> tests/ui/floating_point_powf.rs:38:13
|
||||
|
|
||||
LL | let _ = std::f64::consts::E.powf(x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.exp()`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:37:13
|
||||
--> tests/ui/floating_point_powf.rs:39:13
|
||||
|
|
||||
LL | let _ = std::f64::consts::E.powf(3.1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `3.1f64.exp()`
|
||||
|
||||
error: exponent for bases 2 and e can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:38:13
|
||||
--> tests/ui/floating_point_powf.rs:40:13
|
||||
|
|
||||
LL | let _ = std::f64::consts::E.powf(-3.1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-3.1f64).exp()`
|
||||
|
||||
error: square-root of a number can be computed more efficiently and accurately
|
||||
--> tests/ui/floating_point_powf.rs:39:13
|
||||
--> tests/ui/floating_point_powf.rs:41:13
|
||||
|
|
||||
LL | let _ = x.powf(1.0 / 2.0);
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider using: `x.sqrt()`
|
||||
|
||||
error: cube-root of a number can be computed more accurately
|
||||
--> tests/ui/floating_point_powf.rs:40:13
|
||||
--> tests/ui/floating_point_powf.rs:42:13
|
||||
|
|
||||
LL | let _ = x.powf(1.0 / 3.0);
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider using: `x.cbrt()`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:41:13
|
||||
--> tests/ui/floating_point_powf.rs:43:13
|
||||
|
|
||||
LL | let _ = x.powf(3.0);
|
||||
| ^^^^^^^^^^^ help: consider using: `x.powi(3)`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:42:13
|
||||
--> tests/ui/floating_point_powf.rs:44:13
|
||||
|
|
||||
LL | let _ = x.powf(-2.0);
|
||||
| ^^^^^^^^^^^^ help: consider using: `x.powi(-2)`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:43:13
|
||||
--> tests/ui/floating_point_powf.rs:45:13
|
||||
|
|
||||
LL | let _ = x.powf(-2_147_483_648.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(-2_147_483_648)`
|
||||
|
||||
error: exponentiation with integer powers can be computed more efficiently
|
||||
--> tests/ui/floating_point_powf.rs:44:13
|
||||
--> tests/ui/floating_point_powf.rs:46:13
|
||||
|
|
||||
LL | let _ = x.powf(2_147_483_647.0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(2_147_483_647)`
|
||||
|
@ -1,6 +1,5 @@
|
||||
//@aux-build: proc_macros.rs
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::implicit_return)]
|
||||
#![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)]
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
//@aux-build: proc_macros.rs
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::implicit_return)]
|
||||
#![allow(clippy::needless_return, clippy::needless_bool, unused, clippy::never_loop)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:16:5
|
||||
--> tests/ui/implicit_return.rs:15:5
|
||||
|
|
||||
LL | true
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
@ -8,85 +8,85 @@ LL | true
|
||||
= help: to override `-D warnings` add `#[allow(clippy::implicit_return)]`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:20:15
|
||||
--> tests/ui/implicit_return.rs:19:15
|
||||
|
|
||||
LL | if true { true } else { false }
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:20:29
|
||||
--> tests/ui/implicit_return.rs:19:29
|
||||
|
|
||||
LL | if true { true } else { false }
|
||||
| ^^^^^ help: add `return` as shown: `return false`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:26:17
|
||||
--> tests/ui/implicit_return.rs:25:17
|
||||
|
|
||||
LL | true => false,
|
||||
| ^^^^^ help: add `return` as shown: `return false`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:27:20
|
||||
--> tests/ui/implicit_return.rs:26:20
|
||||
|
|
||||
LL | false => { true },
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:40:9
|
||||
--> tests/ui/implicit_return.rs:39:9
|
||||
|
|
||||
LL | break true;
|
||||
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:47:13
|
||||
--> tests/ui/implicit_return.rs:46:13
|
||||
|
|
||||
LL | break true;
|
||||
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:55:13
|
||||
--> tests/ui/implicit_return.rs:54:13
|
||||
|
|
||||
LL | break true;
|
||||
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:73:18
|
||||
--> tests/ui/implicit_return.rs:72:18
|
||||
|
|
||||
LL | let _ = || { true };
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:74:16
|
||||
--> tests/ui/implicit_return.rs:73:16
|
||||
|
|
||||
LL | let _ = || true;
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:82:5
|
||||
--> tests/ui/implicit_return.rs:81:5
|
||||
|
|
||||
LL | format!("test {}", "test")
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `return` as shown: `return format!("test {}", "test")`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:91:5
|
||||
--> tests/ui/implicit_return.rs:90:5
|
||||
|
|
||||
LL | m!(true, false)
|
||||
| ^^^^^^^^^^^^^^^ help: add `return` as shown: `return m!(true, false)`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:97:13
|
||||
--> tests/ui/implicit_return.rs:96:13
|
||||
|
|
||||
LL | break true;
|
||||
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:102:17
|
||||
--> tests/ui/implicit_return.rs:101:17
|
||||
|
|
||||
LL | break 'outer false;
|
||||
| ^^^^^^^^^^^^^^^^^^ help: change `break` to `return` as shown: `return false`
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:117:5
|
||||
--> tests/ui/implicit_return.rs:116:5
|
||||
|
|
||||
LL | / loop {
|
||||
LL | | m!(true);
|
||||
@ -101,7 +101,7 @@ LL + }
|
||||
|
|
||||
|
||||
error: missing `return` statement
|
||||
--> tests/ui/implicit_return.rs:131:5
|
||||
--> tests/ui/implicit_return.rs:130:5
|
||||
|
|
||||
LL | true
|
||||
| ^^^^ help: add `return` as shown: `return true`
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::let_unit_value)]
|
||||
#![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(lint_reasons)]
|
||||
#![warn(clippy::let_unit_value)]
|
||||
#![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this let-binding has unit value
|
||||
--> tests/ui/let_unit.rs:12:5
|
||||
--> tests/ui/let_unit.rs:11:5
|
||||
|
|
||||
LL | let _x = println!("x");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `println!("x");`
|
||||
@ -8,7 +8,7 @@ LL | let _x = println!("x");
|
||||
= help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]`
|
||||
|
||||
error: this let-binding has unit value
|
||||
--> tests/ui/let_unit.rs:60:5
|
||||
--> tests/ui/let_unit.rs:59:5
|
||||
|
|
||||
LL | / let _ = v
|
||||
LL | | .into_iter()
|
||||
@ -31,7 +31,7 @@ LL + .unwrap();
|
||||
|
|
||||
|
||||
error: this let-binding has unit value
|
||||
--> tests/ui/let_unit.rs:109:5
|
||||
--> tests/ui/let_unit.rs:108:5
|
||||
|
|
||||
LL | / let x = match Some(0) {
|
||||
LL | | None => f2(1),
|
||||
@ -52,7 +52,7 @@ LL + };
|
||||
|
|
||||
|
||||
error: this let-binding has unit value
|
||||
--> tests/ui/let_unit.rs:190:9
|
||||
--> tests/ui/let_unit.rs:189:9
|
||||
|
|
||||
LL | let res = returns_unit();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,31 +1,55 @@
|
||||
#![warn(clippy::lossy_float_literal)]
|
||||
#![allow(overflowing_literals, unused)]
|
||||
#![feature(f128)]
|
||||
#![feature(f16)]
|
||||
|
||||
fn main() {
|
||||
// Lossy whole-number float literals
|
||||
let _: f16 = 4_097.0;
|
||||
let _: f16 = 4_097.;
|
||||
let _: f16 = 4_097.000;
|
||||
let _ = 4_097f16;
|
||||
let _: f16 = -4_097.0;
|
||||
|
||||
let _: f32 = 16_777_216.0;
|
||||
let _: f32 = 16_777_220.0;
|
||||
let _: f32 = 16_777_220.0;
|
||||
let _: f32 = 16_777_220.0;
|
||||
let _ = 16_777_220_f32;
|
||||
let _: f32 = -16_777_220.0;
|
||||
|
||||
let _: f64 = 9_007_199_254_740_992.0;
|
||||
let _: f64 = 9_007_199_254_740_992.0;
|
||||
let _: f64 = 9_007_199_254_740_992.0;
|
||||
let _ = 9_007_199_254_740_992_f64;
|
||||
let _: f64 = -9_007_199_254_740_992.0;
|
||||
|
||||
let _: f128 = 10_384_593_717_069_655_257_060_992_658_440_193.0;
|
||||
let _: f128 = 10_384_593_717_069_655_257_060_992_658_440_193.;
|
||||
let _: f128 = 10_384_593_717_069_655_257_060_992_658_440_193.00;
|
||||
let _ = 10_384_593_717_069_655_257_060_992_658_440_193f128;
|
||||
let _: f128 = -10_384_593_717_069_655_257_060_992_658_440_193.0;
|
||||
|
||||
// Lossless whole number float literals
|
||||
let _: f16 = 4_096.0;
|
||||
let _: f16 = -4_096.0;
|
||||
|
||||
let _: f32 = 16_777_216.0;
|
||||
let _: f32 = 16_777_218.0;
|
||||
let _: f32 = 16_777_220.0;
|
||||
let _: f32 = -16_777_216.0;
|
||||
let _: f32 = -16_777_220.0;
|
||||
|
||||
let _: f64 = 16_777_217.0;
|
||||
let _: f64 = -16_777_217.0;
|
||||
let _: f64 = 9_007_199_254_740_992.0;
|
||||
let _: f64 = -9_007_199_254_740_992.0;
|
||||
|
||||
let _: f128 = 9_007_199_254_740_993.0;
|
||||
let _: f128 = -9_007_199_254_740_993.0;
|
||||
let _: f128 = 10_384_593_717_069_655_257_060_992_658_440_192.0;
|
||||
let _: f128 = -10_384_593_717_069_655_257_060_992_658_440_192.0;
|
||||
|
||||
// Ignored whole number float literals
|
||||
let _: f32 = 1e25;
|
||||
let _: f32 = 1E25;
|
||||
|
@ -1,31 +1,55 @@
|
||||
#![warn(clippy::lossy_float_literal)]
|
||||
#![allow(overflowing_literals, unused)]
|
||||
#![feature(f128)]
|
||||
#![feature(f16)]
|
||||
|
||||
fn main() {
|
||||
// Lossy whole-number float literals
|
||||
let _: f16 = 4_097.0;
|
||||
let _: f16 = 4_097.;
|
||||
let _: f16 = 4_097.000;
|
||||
let _ = 4_097f16;
|
||||
let _: f16 = -4_097.0;
|
||||
|
||||
let _: f32 = 16_777_217.0;
|
||||
let _: f32 = 16_777_219.0;
|
||||
let _: f32 = 16_777_219.;
|
||||
let _: f32 = 16_777_219.000;
|
||||
let _ = 16_777_219f32;
|
||||
let _: f32 = -16_777_219.0;
|
||||
|
||||
let _: f64 = 9_007_199_254_740_993.0;
|
||||
let _: f64 = 9_007_199_254_740_993.;
|
||||
let _: f64 = 9_007_199_254_740_993.00;
|
||||
let _ = 9_007_199_254_740_993f64;
|
||||
let _: f64 = -9_007_199_254_740_993.0;
|
||||
|
||||
let _: f128 = 10_384_593_717_069_655_257_060_992_658_440_193.0;
|
||||
let _: f128 = 10_384_593_717_069_655_257_060_992_658_440_193.;
|
||||
let _: f128 = 10_384_593_717_069_655_257_060_992_658_440_193.00;
|
||||
let _ = 10_384_593_717_069_655_257_060_992_658_440_193f128;
|
||||
let _: f128 = -10_384_593_717_069_655_257_060_992_658_440_193.0;
|
||||
|
||||
// Lossless whole number float literals
|
||||
let _: f16 = 4_096.0;
|
||||
let _: f16 = -4_096.0;
|
||||
|
||||
let _: f32 = 16_777_216.0;
|
||||
let _: f32 = 16_777_218.0;
|
||||
let _: f32 = 16_777_220.0;
|
||||
let _: f32 = -16_777_216.0;
|
||||
let _: f32 = -16_777_220.0;
|
||||
|
||||
let _: f64 = 16_777_217.0;
|
||||
let _: f64 = -16_777_217.0;
|
||||
let _: f64 = 9_007_199_254_740_992.0;
|
||||
let _: f64 = -9_007_199_254_740_992.0;
|
||||
|
||||
let _: f128 = 9_007_199_254_740_993.0;
|
||||
let _: f128 = -9_007_199_254_740_993.0;
|
||||
let _: f128 = 10_384_593_717_069_655_257_060_992_658_440_192.0;
|
||||
let _: f128 = -10_384_593_717_069_655_257_060_992_658_440_192.0;
|
||||
|
||||
// Ignored whole number float literals
|
||||
let _: f32 = 1e25;
|
||||
let _: f32 = 1E25;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:6:18
|
||||
--> tests/ui/lossy_float_literal.rs:14:18
|
||||
|
|
||||
LL | let _: f32 = 16_777_217.0;
|
||||
| ^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_216.0`
|
||||
@ -8,61 +8,61 @@ LL | let _: f32 = 16_777_217.0;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::lossy_float_literal)]`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:7:18
|
||||
--> tests/ui/lossy_float_literal.rs:15:18
|
||||
|
|
||||
LL | let _: f32 = 16_777_219.0;
|
||||
| ^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220.0`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:8:18
|
||||
--> tests/ui/lossy_float_literal.rs:16:18
|
||||
|
|
||||
LL | let _: f32 = 16_777_219.;
|
||||
| ^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220.0`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:9:18
|
||||
--> tests/ui/lossy_float_literal.rs:17:18
|
||||
|
|
||||
LL | let _: f32 = 16_777_219.000;
|
||||
| ^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220.0`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:10:13
|
||||
--> tests/ui/lossy_float_literal.rs:18:13
|
||||
|
|
||||
LL | let _ = 16_777_219f32;
|
||||
| ^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220_f32`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:11:19
|
||||
--> tests/ui/lossy_float_literal.rs:19:19
|
||||
|
|
||||
LL | let _: f32 = -16_777_219.0;
|
||||
| ^^^^^^^^^^^^ help: consider changing the type or replacing it with: `16_777_220.0`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:12:18
|
||||
--> tests/ui/lossy_float_literal.rs:21:18
|
||||
|
|
||||
LL | let _: f64 = 9_007_199_254_740_993.0;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992.0`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:13:18
|
||||
--> tests/ui/lossy_float_literal.rs:22:18
|
||||
|
|
||||
LL | let _: f64 = 9_007_199_254_740_993.;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992.0`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:14:18
|
||||
--> tests/ui/lossy_float_literal.rs:23:18
|
||||
|
|
||||
LL | let _: f64 = 9_007_199_254_740_993.00;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992.0`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:15:13
|
||||
--> tests/ui/lossy_float_literal.rs:24:13
|
||||
|
|
||||
LL | let _ = 9_007_199_254_740_993f64;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992_f64`
|
||||
|
||||
error: literal cannot be represented as the underlying type without loss of precision
|
||||
--> tests/ui/lossy_float_literal.rs:16:19
|
||||
--> tests/ui/lossy_float_literal.rs:25:19
|
||||
|
|
||||
LL | let _: f64 = -9_007_199_254_740_993.0;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or replacing it with: `9_007_199_254_740_992.0`
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
//@ignore-32bit
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
|
||||
#![allow(clippy::single_component_path_imports)]
|
||||
#![warn(clippy::macro_use_imports)]
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
//@ignore-32bit
|
||||
|
||||
#![feature(lint_reasons)]
|
||||
#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
|
||||
#![allow(clippy::single_component_path_imports)]
|
||||
#![warn(clippy::macro_use_imports)]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user