mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-25 11:57:25 +00:00
uplift clippy::clone_double_ref
as suspicious_double_ref_op
This commit is contained in:
parent
0339d4e982
commit
81a614145f
11 changed files with 61 additions and 170 deletions
|
@ -313,7 +313,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
|
||||||
crate::methods::CHARS_NEXT_CMP_INFO,
|
crate::methods::CHARS_NEXT_CMP_INFO,
|
||||||
crate::methods::CLEAR_WITH_DRAIN_INFO,
|
crate::methods::CLEAR_WITH_DRAIN_INFO,
|
||||||
crate::methods::CLONED_INSTEAD_OF_COPIED_INFO,
|
crate::methods::CLONED_INSTEAD_OF_COPIED_INFO,
|
||||||
crate::methods::CLONE_DOUBLE_REF_INFO,
|
|
||||||
crate::methods::CLONE_ON_COPY_INFO,
|
crate::methods::CLONE_ON_COPY_INFO,
|
||||||
crate::methods::CLONE_ON_REF_PTR_INFO,
|
crate::methods::CLONE_ON_REF_PTR_INFO,
|
||||||
crate::methods::COLLAPSIBLE_STR_REPLACE_INFO,
|
crate::methods::COLLAPSIBLE_STR_REPLACE_INFO,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use clippy_utils::diagnostics::{span_lint_and_sugg, span_lint_and_then};
|
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||||
use clippy_utils::get_parent_node;
|
use clippy_utils::get_parent_node;
|
||||||
use clippy_utils::source::snippet_with_context;
|
use clippy_utils::source::snippet_with_context;
|
||||||
use clippy_utils::sugg;
|
|
||||||
use clippy_utils::ty::is_copy;
|
use clippy_utils::ty::is_copy;
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_hir::{BindingAnnotation, ByRef, Expr, ExprKind, MatchSource, Node, PatKind, QPath};
|
use rustc_hir::{BindingAnnotation, ByRef, Expr, ExprKind, MatchSource, Node, PatKind, QPath};
|
||||||
|
@ -9,7 +8,6 @@ use rustc_lint::LateContext;
|
||||||
use rustc_middle::ty::{self, adjustment::Adjust, print::with_forced_trimmed_paths};
|
use rustc_middle::ty::{self, adjustment::Adjust, print::with_forced_trimmed_paths};
|
||||||
use rustc_span::symbol::{sym, Symbol};
|
use rustc_span::symbol::{sym, Symbol};
|
||||||
|
|
||||||
use super::CLONE_DOUBLE_REF;
|
|
||||||
use super::CLONE_ON_COPY;
|
use super::CLONE_ON_COPY;
|
||||||
|
|
||||||
/// Checks for the `CLONE_ON_COPY` lint.
|
/// Checks for the `CLONE_ON_COPY` lint.
|
||||||
|
@ -42,41 +40,7 @@ pub(super) fn check(
|
||||||
|
|
||||||
let ty = cx.typeck_results().expr_ty(expr);
|
let ty = cx.typeck_results().expr_ty(expr);
|
||||||
if let ty::Ref(_, inner, _) = arg_ty.kind() {
|
if let ty::Ref(_, inner, _) = arg_ty.kind() {
|
||||||
if let ty::Ref(_, innermost, _) = inner.kind() {
|
if let ty::Ref(..) = inner.kind() {
|
||||||
span_lint_and_then(
|
|
||||||
cx,
|
|
||||||
CLONE_DOUBLE_REF,
|
|
||||||
expr.span,
|
|
||||||
&with_forced_trimmed_paths!(format!(
|
|
||||||
"using `clone` on a double-reference; \
|
|
||||||
this will copy the reference of type `{ty}` instead of cloning the inner type"
|
|
||||||
)),
|
|
||||||
|diag| {
|
|
||||||
if let Some(snip) = sugg::Sugg::hir_opt(cx, arg) {
|
|
||||||
let mut ty = innermost;
|
|
||||||
let mut n = 0;
|
|
||||||
while let ty::Ref(_, inner, _) = ty.kind() {
|
|
||||||
ty = inner;
|
|
||||||
n += 1;
|
|
||||||
}
|
|
||||||
let refs = "&".repeat(n + 1);
|
|
||||||
let derefs = "*".repeat(n);
|
|
||||||
let explicit = with_forced_trimmed_paths!(format!("<{refs}{ty}>::clone({snip})"));
|
|
||||||
diag.span_suggestion(
|
|
||||||
expr.span,
|
|
||||||
"try dereferencing it",
|
|
||||||
with_forced_trimmed_paths!(format!("{refs}({derefs}{}).clone()", snip.deref())),
|
|
||||||
Applicability::MaybeIncorrect,
|
|
||||||
);
|
|
||||||
diag.span_suggestion(
|
|
||||||
expr.span,
|
|
||||||
"or try being explicit if you are sure, that you want to clone a reference",
|
|
||||||
explicit,
|
|
||||||
Applicability::MaybeIncorrect,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
return; // don't report clone_on_copy
|
return; // don't report clone_on_copy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -984,29 +984,6 @@ declare_clippy_lint! {
|
||||||
"using 'clone' on a ref-counted pointer"
|
"using 'clone' on a ref-counted pointer"
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_clippy_lint! {
|
|
||||||
/// ### What it does
|
|
||||||
/// Checks for usage of `.clone()` on an `&&T`.
|
|
||||||
///
|
|
||||||
/// ### Why is this bad?
|
|
||||||
/// Cloning an `&&T` copies the inner `&T`, instead of
|
|
||||||
/// cloning the underlying `T`.
|
|
||||||
///
|
|
||||||
/// ### Example
|
|
||||||
/// ```rust
|
|
||||||
/// fn main() {
|
|
||||||
/// let x = vec![1];
|
|
||||||
/// let y = &&x;
|
|
||||||
/// let z = y.clone();
|
|
||||||
/// println!("{:p} {:p}", *y, z); // prints out the same pointer
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
#[clippy::version = "pre 1.29.0"]
|
|
||||||
pub CLONE_DOUBLE_REF,
|
|
||||||
correctness,
|
|
||||||
"using `clone` on `&&T`"
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
/// ### What it does
|
/// ### What it does
|
||||||
/// Checks for usage of `.to_string()` on an `&&T` where
|
/// Checks for usage of `.to_string()` on an `&&T` where
|
||||||
|
@ -3258,7 +3235,6 @@ impl_lint_pass!(Methods => [
|
||||||
CHARS_LAST_CMP,
|
CHARS_LAST_CMP,
|
||||||
CLONE_ON_COPY,
|
CLONE_ON_COPY,
|
||||||
CLONE_ON_REF_PTR,
|
CLONE_ON_REF_PTR,
|
||||||
CLONE_DOUBLE_REF,
|
|
||||||
COLLAPSIBLE_STR_REPLACE,
|
COLLAPSIBLE_STR_REPLACE,
|
||||||
ITER_OVEREAGER_CLONED,
|
ITER_OVEREAGER_CLONED,
|
||||||
CLONED_INSTEAD_OF_COPIED,
|
CLONED_INSTEAD_OF_COPIED,
|
||||||
|
|
|
@ -30,6 +30,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
|
||||||
("clippy::stutter", "clippy::module_name_repetitions"),
|
("clippy::stutter", "clippy::module_name_repetitions"),
|
||||||
("clippy::to_string_in_display", "clippy::recursive_format_impl"),
|
("clippy::to_string_in_display", "clippy::recursive_format_impl"),
|
||||||
("clippy::zero_width_space", "clippy::invisible_characters"),
|
("clippy::zero_width_space", "clippy::invisible_characters"),
|
||||||
|
("clippy::clone_double_ref", "suspicious_double_ref_op"),
|
||||||
("clippy::drop_bounds", "drop_bounds"),
|
("clippy::drop_bounds", "drop_bounds"),
|
||||||
("clippy::for_loop_over_option", "for_loops_over_fallibles"),
|
("clippy::for_loop_over_option", "for_loops_over_fallibles"),
|
||||||
("clippy::for_loop_over_result", "for_loops_over_fallibles"),
|
("clippy::for_loop_over_result", "for_loops_over_fallibles"),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::borrow_deref_ref,
|
clippy::borrow_deref_ref,
|
||||||
clippy::clone_double_ref,
|
suspicious_double_ref_op,
|
||||||
clippy::explicit_auto_deref,
|
clippy::explicit_auto_deref,
|
||||||
clippy::needless_borrow,
|
clippy::needless_borrow,
|
||||||
clippy::uninlined_format_args
|
clippy::uninlined_format_args
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::borrow_deref_ref,
|
clippy::borrow_deref_ref,
|
||||||
clippy::clone_double_ref,
|
suspicious_double_ref_op,
|
||||||
clippy::explicit_auto_deref,
|
clippy::explicit_auto_deref,
|
||||||
clippy::needless_borrow,
|
clippy::needless_borrow,
|
||||||
clippy::uninlined_format_args
|
clippy::uninlined_format_args
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#![allow(enum_intrinsics_non_enums)]
|
#![allow(enum_intrinsics_non_enums)]
|
||||||
#![allow(non_fmt_panics)]
|
#![allow(non_fmt_panics)]
|
||||||
#![allow(named_arguments_used_positionally)]
|
#![allow(named_arguments_used_positionally)]
|
||||||
|
#![allow(suspicious_double_ref_op)]
|
||||||
#![allow(temporary_cstring_as_ptr)]
|
#![allow(temporary_cstring_as_ptr)]
|
||||||
#![allow(unknown_lints)]
|
#![allow(unknown_lints)]
|
||||||
#![allow(unused_labels)]
|
#![allow(unused_labels)]
|
||||||
|
@ -67,6 +68,7 @@
|
||||||
#![warn(clippy::module_name_repetitions)]
|
#![warn(clippy::module_name_repetitions)]
|
||||||
#![warn(clippy::recursive_format_impl)]
|
#![warn(clippy::recursive_format_impl)]
|
||||||
#![warn(clippy::invisible_characters)]
|
#![warn(clippy::invisible_characters)]
|
||||||
|
#![warn(suspicious_double_ref_op)]
|
||||||
#![warn(drop_bounds)]
|
#![warn(drop_bounds)]
|
||||||
#![warn(for_loops_over_fallibles)]
|
#![warn(for_loops_over_fallibles)]
|
||||||
#![warn(for_loops_over_fallibles)]
|
#![warn(for_loops_over_fallibles)]
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#![allow(enum_intrinsics_non_enums)]
|
#![allow(enum_intrinsics_non_enums)]
|
||||||
#![allow(non_fmt_panics)]
|
#![allow(non_fmt_panics)]
|
||||||
#![allow(named_arguments_used_positionally)]
|
#![allow(named_arguments_used_positionally)]
|
||||||
|
#![allow(suspicious_double_ref_op)]
|
||||||
#![allow(temporary_cstring_as_ptr)]
|
#![allow(temporary_cstring_as_ptr)]
|
||||||
#![allow(unknown_lints)]
|
#![allow(unknown_lints)]
|
||||||
#![allow(unused_labels)]
|
#![allow(unused_labels)]
|
||||||
|
@ -67,6 +68,7 @@
|
||||||
#![warn(clippy::stutter)]
|
#![warn(clippy::stutter)]
|
||||||
#![warn(clippy::to_string_in_display)]
|
#![warn(clippy::to_string_in_display)]
|
||||||
#![warn(clippy::zero_width_space)]
|
#![warn(clippy::zero_width_space)]
|
||||||
|
#![warn(clippy::clone_double_ref)]
|
||||||
#![warn(clippy::drop_bounds)]
|
#![warn(clippy::drop_bounds)]
|
||||||
#![warn(clippy::for_loop_over_option)]
|
#![warn(clippy::for_loop_over_option)]
|
||||||
#![warn(clippy::for_loop_over_result)]
|
#![warn(clippy::for_loop_over_result)]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: lint `clippy::almost_complete_letter_range` has been renamed to `clippy::almost_complete_range`
|
error: lint `clippy::almost_complete_letter_range` has been renamed to `clippy::almost_complete_range`
|
||||||
--> $DIR/rename.rs:42:9
|
--> $DIR/rename.rs:43:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::almost_complete_letter_range)]
|
LL | #![warn(clippy::almost_complete_letter_range)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::almost_complete_range`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::almost_complete_range`
|
||||||
|
@ -7,250 +7,256 @@ LL | #![warn(clippy::almost_complete_letter_range)]
|
||||||
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
|
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
|
||||||
|
|
||||||
error: lint `clippy::blacklisted_name` has been renamed to `clippy::disallowed_names`
|
error: lint `clippy::blacklisted_name` has been renamed to `clippy::disallowed_names`
|
||||||
--> $DIR/rename.rs:43:9
|
--> $DIR/rename.rs:44:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::blacklisted_name)]
|
LL | #![warn(clippy::blacklisted_name)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_names`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_names`
|
||||||
|
|
||||||
error: lint `clippy::block_in_if_condition_expr` has been renamed to `clippy::blocks_in_if_conditions`
|
error: lint `clippy::block_in_if_condition_expr` has been renamed to `clippy::blocks_in_if_conditions`
|
||||||
--> $DIR/rename.rs:44:9
|
--> $DIR/rename.rs:45:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::block_in_if_condition_expr)]
|
LL | #![warn(clippy::block_in_if_condition_expr)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions`
|
||||||
|
|
||||||
error: lint `clippy::block_in_if_condition_stmt` has been renamed to `clippy::blocks_in_if_conditions`
|
error: lint `clippy::block_in_if_condition_stmt` has been renamed to `clippy::blocks_in_if_conditions`
|
||||||
--> $DIR/rename.rs:45:9
|
--> $DIR/rename.rs:46:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::block_in_if_condition_stmt)]
|
LL | #![warn(clippy::block_in_if_condition_stmt)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions`
|
||||||
|
|
||||||
error: lint `clippy::box_vec` has been renamed to `clippy::box_collection`
|
error: lint `clippy::box_vec` has been renamed to `clippy::box_collection`
|
||||||
--> $DIR/rename.rs:46:9
|
--> $DIR/rename.rs:47:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::box_vec)]
|
LL | #![warn(clippy::box_vec)]
|
||||||
| ^^^^^^^^^^^^^^^ help: use the new name: `clippy::box_collection`
|
| ^^^^^^^^^^^^^^^ help: use the new name: `clippy::box_collection`
|
||||||
|
|
||||||
error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redundant_static_lifetimes`
|
error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redundant_static_lifetimes`
|
||||||
--> $DIR/rename.rs:47:9
|
--> $DIR/rename.rs:48:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::const_static_lifetime)]
|
LL | #![warn(clippy::const_static_lifetime)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes`
|
||||||
|
|
||||||
error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity`
|
error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity`
|
||||||
--> $DIR/rename.rs:48:9
|
--> $DIR/rename.rs:49:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::cyclomatic_complexity)]
|
LL | #![warn(clippy::cyclomatic_complexity)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity`
|
||||||
|
|
||||||
error: lint `clippy::derive_hash_xor_eq` has been renamed to `clippy::derived_hash_with_manual_eq`
|
error: lint `clippy::derive_hash_xor_eq` has been renamed to `clippy::derived_hash_with_manual_eq`
|
||||||
--> $DIR/rename.rs:49:9
|
--> $DIR/rename.rs:50:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::derive_hash_xor_eq)]
|
LL | #![warn(clippy::derive_hash_xor_eq)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::derived_hash_with_manual_eq`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::derived_hash_with_manual_eq`
|
||||||
|
|
||||||
error: lint `clippy::disallowed_method` has been renamed to `clippy::disallowed_methods`
|
error: lint `clippy::disallowed_method` has been renamed to `clippy::disallowed_methods`
|
||||||
--> $DIR/rename.rs:50:9
|
--> $DIR/rename.rs:51:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::disallowed_method)]
|
LL | #![warn(clippy::disallowed_method)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_methods`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_methods`
|
||||||
|
|
||||||
error: lint `clippy::disallowed_type` has been renamed to `clippy::disallowed_types`
|
error: lint `clippy::disallowed_type` has been renamed to `clippy::disallowed_types`
|
||||||
--> $DIR/rename.rs:51:9
|
--> $DIR/rename.rs:52:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::disallowed_type)]
|
LL | #![warn(clippy::disallowed_type)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_types`
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_types`
|
||||||
|
|
||||||
error: lint `clippy::eval_order_dependence` has been renamed to `clippy::mixed_read_write_in_expression`
|
error: lint `clippy::eval_order_dependence` has been renamed to `clippy::mixed_read_write_in_expression`
|
||||||
--> $DIR/rename.rs:52:9
|
--> $DIR/rename.rs:53:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::eval_order_dependence)]
|
LL | #![warn(clippy::eval_order_dependence)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::mixed_read_write_in_expression`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::mixed_read_write_in_expression`
|
||||||
|
|
||||||
error: lint `clippy::identity_conversion` has been renamed to `clippy::useless_conversion`
|
error: lint `clippy::identity_conversion` has been renamed to `clippy::useless_conversion`
|
||||||
--> $DIR/rename.rs:53:9
|
--> $DIR/rename.rs:54:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::identity_conversion)]
|
LL | #![warn(clippy::identity_conversion)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::useless_conversion`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::useless_conversion`
|
||||||
|
|
||||||
error: lint `clippy::if_let_some_result` has been renamed to `clippy::match_result_ok`
|
error: lint `clippy::if_let_some_result` has been renamed to `clippy::match_result_ok`
|
||||||
--> $DIR/rename.rs:54:9
|
--> $DIR/rename.rs:55:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::if_let_some_result)]
|
LL | #![warn(clippy::if_let_some_result)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::match_result_ok`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::match_result_ok`
|
||||||
|
|
||||||
error: lint `clippy::logic_bug` has been renamed to `clippy::overly_complex_bool_expr`
|
error: lint `clippy::logic_bug` has been renamed to `clippy::overly_complex_bool_expr`
|
||||||
--> $DIR/rename.rs:55:9
|
--> $DIR/rename.rs:56:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::logic_bug)]
|
LL | #![warn(clippy::logic_bug)]
|
||||||
| ^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::overly_complex_bool_expr`
|
| ^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::overly_complex_bool_expr`
|
||||||
|
|
||||||
error: lint `clippy::new_without_default_derive` has been renamed to `clippy::new_without_default`
|
error: lint `clippy::new_without_default_derive` has been renamed to `clippy::new_without_default`
|
||||||
--> $DIR/rename.rs:56:9
|
--> $DIR/rename.rs:57:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::new_without_default_derive)]
|
LL | #![warn(clippy::new_without_default_derive)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default`
|
||||||
|
|
||||||
error: lint `clippy::option_and_then_some` has been renamed to `clippy::bind_instead_of_map`
|
error: lint `clippy::option_and_then_some` has been renamed to `clippy::bind_instead_of_map`
|
||||||
--> $DIR/rename.rs:57:9
|
--> $DIR/rename.rs:58:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::option_and_then_some)]
|
LL | #![warn(clippy::option_and_then_some)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::bind_instead_of_map`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::bind_instead_of_map`
|
||||||
|
|
||||||
error: lint `clippy::option_expect_used` has been renamed to `clippy::expect_used`
|
error: lint `clippy::option_expect_used` has been renamed to `clippy::expect_used`
|
||||||
--> $DIR/rename.rs:58:9
|
--> $DIR/rename.rs:59:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::option_expect_used)]
|
LL | #![warn(clippy::option_expect_used)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used`
|
||||||
|
|
||||||
error: lint `clippy::option_map_unwrap_or` has been renamed to `clippy::map_unwrap_or`
|
error: lint `clippy::option_map_unwrap_or` has been renamed to `clippy::map_unwrap_or`
|
||||||
--> $DIR/rename.rs:59:9
|
--> $DIR/rename.rs:60:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::option_map_unwrap_or)]
|
LL | #![warn(clippy::option_map_unwrap_or)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
|
||||||
|
|
||||||
error: lint `clippy::option_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or`
|
error: lint `clippy::option_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or`
|
||||||
--> $DIR/rename.rs:60:9
|
--> $DIR/rename.rs:61:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::option_map_unwrap_or_else)]
|
LL | #![warn(clippy::option_map_unwrap_or_else)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
|
||||||
|
|
||||||
error: lint `clippy::option_unwrap_used` has been renamed to `clippy::unwrap_used`
|
error: lint `clippy::option_unwrap_used` has been renamed to `clippy::unwrap_used`
|
||||||
--> $DIR/rename.rs:61:9
|
--> $DIR/rename.rs:62:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::option_unwrap_used)]
|
LL | #![warn(clippy::option_unwrap_used)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used`
|
||||||
|
|
||||||
error: lint `clippy::ref_in_deref` has been renamed to `clippy::needless_borrow`
|
error: lint `clippy::ref_in_deref` has been renamed to `clippy::needless_borrow`
|
||||||
--> $DIR/rename.rs:62:9
|
--> $DIR/rename.rs:63:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::ref_in_deref)]
|
LL | #![warn(clippy::ref_in_deref)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::needless_borrow`
|
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::needless_borrow`
|
||||||
|
|
||||||
error: lint `clippy::result_expect_used` has been renamed to `clippy::expect_used`
|
error: lint `clippy::result_expect_used` has been renamed to `clippy::expect_used`
|
||||||
--> $DIR/rename.rs:63:9
|
--> $DIR/rename.rs:64:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::result_expect_used)]
|
LL | #![warn(clippy::result_expect_used)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used`
|
||||||
|
|
||||||
error: lint `clippy::result_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or`
|
error: lint `clippy::result_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or`
|
||||||
--> $DIR/rename.rs:64:9
|
--> $DIR/rename.rs:65:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::result_map_unwrap_or_else)]
|
LL | #![warn(clippy::result_map_unwrap_or_else)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
|
||||||
|
|
||||||
error: lint `clippy::result_unwrap_used` has been renamed to `clippy::unwrap_used`
|
error: lint `clippy::result_unwrap_used` has been renamed to `clippy::unwrap_used`
|
||||||
--> $DIR/rename.rs:65:9
|
--> $DIR/rename.rs:66:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::result_unwrap_used)]
|
LL | #![warn(clippy::result_unwrap_used)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used`
|
||||||
|
|
||||||
error: lint `clippy::single_char_push_str` has been renamed to `clippy::single_char_add_str`
|
error: lint `clippy::single_char_push_str` has been renamed to `clippy::single_char_add_str`
|
||||||
--> $DIR/rename.rs:66:9
|
--> $DIR/rename.rs:67:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::single_char_push_str)]
|
LL | #![warn(clippy::single_char_push_str)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::single_char_add_str`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::single_char_add_str`
|
||||||
|
|
||||||
error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions`
|
error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions`
|
||||||
--> $DIR/rename.rs:67:9
|
--> $DIR/rename.rs:68:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::stutter)]
|
LL | #![warn(clippy::stutter)]
|
||||||
| ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions`
|
| ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions`
|
||||||
|
|
||||||
error: lint `clippy::to_string_in_display` has been renamed to `clippy::recursive_format_impl`
|
error: lint `clippy::to_string_in_display` has been renamed to `clippy::recursive_format_impl`
|
||||||
--> $DIR/rename.rs:68:9
|
--> $DIR/rename.rs:69:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::to_string_in_display)]
|
LL | #![warn(clippy::to_string_in_display)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::recursive_format_impl`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::recursive_format_impl`
|
||||||
|
|
||||||
error: lint `clippy::zero_width_space` has been renamed to `clippy::invisible_characters`
|
error: lint `clippy::zero_width_space` has been renamed to `clippy::invisible_characters`
|
||||||
--> $DIR/rename.rs:69:9
|
--> $DIR/rename.rs:70:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::zero_width_space)]
|
LL | #![warn(clippy::zero_width_space)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::invisible_characters`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::invisible_characters`
|
||||||
|
|
||||||
|
error: lint `clippy::clone_double_ref` has been renamed to `suspicious_double_ref_op`
|
||||||
|
--> $DIR/rename.rs:71:9
|
||||||
|
|
|
||||||
|
LL | #![warn(clippy::clone_double_ref)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `suspicious_double_ref_op`
|
||||||
|
|
||||||
error: lint `clippy::drop_bounds` has been renamed to `drop_bounds`
|
error: lint `clippy::drop_bounds` has been renamed to `drop_bounds`
|
||||||
--> $DIR/rename.rs:70:9
|
--> $DIR/rename.rs:72:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::drop_bounds)]
|
LL | #![warn(clippy::drop_bounds)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds`
|
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds`
|
||||||
|
|
||||||
error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles`
|
error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles`
|
||||||
--> $DIR/rename.rs:71:9
|
--> $DIR/rename.rs:73:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::for_loop_over_option)]
|
LL | #![warn(clippy::for_loop_over_option)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
||||||
|
|
||||||
error: lint `clippy::for_loop_over_result` has been renamed to `for_loops_over_fallibles`
|
error: lint `clippy::for_loop_over_result` has been renamed to `for_loops_over_fallibles`
|
||||||
--> $DIR/rename.rs:72:9
|
--> $DIR/rename.rs:74:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::for_loop_over_result)]
|
LL | #![warn(clippy::for_loop_over_result)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
||||||
|
|
||||||
error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_over_fallibles`
|
error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_over_fallibles`
|
||||||
--> $DIR/rename.rs:73:9
|
--> $DIR/rename.rs:75:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::for_loops_over_fallibles)]
|
LL | #![warn(clippy::for_loops_over_fallibles)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles`
|
||||||
|
|
||||||
error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter`
|
error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter`
|
||||||
--> $DIR/rename.rs:74:9
|
--> $DIR/rename.rs:76:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::into_iter_on_array)]
|
LL | #![warn(clippy::into_iter_on_array)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `array_into_iter`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `array_into_iter`
|
||||||
|
|
||||||
error: lint `clippy::invalid_atomic_ordering` has been renamed to `invalid_atomic_ordering`
|
error: lint `clippy::invalid_atomic_ordering` has been renamed to `invalid_atomic_ordering`
|
||||||
--> $DIR/rename.rs:75:9
|
--> $DIR/rename.rs:77:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::invalid_atomic_ordering)]
|
LL | #![warn(clippy::invalid_atomic_ordering)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_atomic_ordering`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_atomic_ordering`
|
||||||
|
|
||||||
error: lint `clippy::invalid_ref` has been renamed to `invalid_value`
|
error: lint `clippy::invalid_ref` has been renamed to `invalid_value`
|
||||||
--> $DIR/rename.rs:76:9
|
--> $DIR/rename.rs:78:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::invalid_ref)]
|
LL | #![warn(clippy::invalid_ref)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_value`
|
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_value`
|
||||||
|
|
||||||
error: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop`
|
error: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop`
|
||||||
--> $DIR/rename.rs:77:9
|
--> $DIR/rename.rs:79:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::let_underscore_drop)]
|
LL | #![warn(clippy::let_underscore_drop)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop`
|
||||||
|
|
||||||
error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums`
|
error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums`
|
||||||
--> $DIR/rename.rs:78:9
|
--> $DIR/rename.rs:80:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::mem_discriminant_non_enum)]
|
LL | #![warn(clippy::mem_discriminant_non_enum)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums`
|
||||||
|
|
||||||
error: lint `clippy::panic_params` has been renamed to `non_fmt_panics`
|
error: lint `clippy::panic_params` has been renamed to `non_fmt_panics`
|
||||||
--> $DIR/rename.rs:79:9
|
--> $DIR/rename.rs:81:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::panic_params)]
|
LL | #![warn(clippy::panic_params)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panics`
|
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panics`
|
||||||
|
|
||||||
error: lint `clippy::positional_named_format_parameters` has been renamed to `named_arguments_used_positionally`
|
error: lint `clippy::positional_named_format_parameters` has been renamed to `named_arguments_used_positionally`
|
||||||
--> $DIR/rename.rs:80:9
|
--> $DIR/rename.rs:82:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::positional_named_format_parameters)]
|
LL | #![warn(clippy::positional_named_format_parameters)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `named_arguments_used_positionally`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `named_arguments_used_positionally`
|
||||||
|
|
||||||
error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `temporary_cstring_as_ptr`
|
error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `temporary_cstring_as_ptr`
|
||||||
--> $DIR/rename.rs:81:9
|
--> $DIR/rename.rs:83:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::temporary_cstring_as_ptr)]
|
LL | #![warn(clippy::temporary_cstring_as_ptr)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `temporary_cstring_as_ptr`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `temporary_cstring_as_ptr`
|
||||||
|
|
||||||
error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints`
|
error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints`
|
||||||
--> $DIR/rename.rs:82:9
|
--> $DIR/rename.rs:84:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::unknown_clippy_lints)]
|
LL | #![warn(clippy::unknown_clippy_lints)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints`
|
||||||
|
|
||||||
error: lint `clippy::unused_label` has been renamed to `unused_labels`
|
error: lint `clippy::unused_label` has been renamed to `unused_labels`
|
||||||
--> $DIR/rename.rs:83:9
|
--> $DIR/rename.rs:85:9
|
||||||
|
|
|
|
||||||
LL | #![warn(clippy::unused_label)]
|
LL | #![warn(clippy::unused_label)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels`
|
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels`
|
||||||
|
|
||||||
error: aborting due to 42 previous errors
|
error: aborting due to 43 previous errors
|
||||||
|
|
||||||
|
|
|
@ -42,14 +42,6 @@ fn clone_on_copy_generic<T: Copy>(t: T) {
|
||||||
Some(t).clone();
|
Some(t).clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clone_on_double_ref() {
|
|
||||||
let x = vec![1];
|
|
||||||
let y = &&x;
|
|
||||||
let z: &Vec<_> = y.clone();
|
|
||||||
|
|
||||||
println!("{:p} {:p}", *y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
mod many_derefs {
|
mod many_derefs {
|
||||||
struct A;
|
struct A;
|
||||||
struct B;
|
struct B;
|
||||||
|
@ -84,11 +76,6 @@ mod many_derefs {
|
||||||
let _: E = a.clone();
|
let _: E = a.clone();
|
||||||
let _: E = *****a;
|
let _: E = *****a;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check(mut encoded: &[u8]) {
|
|
||||||
let _ = &mut encoded.clone();
|
|
||||||
let _ = &encoded.clone();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mod issue2076 {
|
mod issue2076 {
|
||||||
|
|
|
@ -44,63 +44,17 @@ error: using `clone` on type `Option<T>` which implements the `Copy` trait
|
||||||
LL | Some(t).clone();
|
LL | Some(t).clone();
|
||||||
| ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
|
| ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
|
||||||
|
|
||||||
error: using `clone` on a double-reference; this will copy the reference of type `&Vec<i32>` instead of cloning the inner type
|
|
||||||
--> $DIR/unnecessary_clone.rs:48:22
|
|
||||||
|
|
|
||||||
LL | let z: &Vec<_> = y.clone();
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `#[deny(clippy::clone_double_ref)]` on by default
|
|
||||||
help: try dereferencing it
|
|
||||||
|
|
|
||||||
LL | let z: &Vec<_> = &(*y).clone();
|
|
||||||
| ~~~~~~~~~~~~~
|
|
||||||
help: or try being explicit if you are sure, that you want to clone a reference
|
|
||||||
|
|
|
||||||
LL | let z: &Vec<_> = <&Vec<i32>>::clone(y);
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: using `clone` on type `E` which implements the `Copy` trait
|
error: using `clone` on type `E` which implements the `Copy` trait
|
||||||
--> $DIR/unnecessary_clone.rs:84:20
|
--> $DIR/unnecessary_clone.rs:76:20
|
||||||
|
|
|
|
||||||
LL | let _: E = a.clone();
|
LL | let _: E = a.clone();
|
||||||
| ^^^^^^^^^ help: try dereferencing it: `*****a`
|
| ^^^^^^^^^ help: try dereferencing it: `*****a`
|
||||||
|
|
||||||
error: using `clone` on a double-reference; this will copy the reference of type `&[u8]` instead of cloning the inner type
|
|
||||||
--> $DIR/unnecessary_clone.rs:89:22
|
|
||||||
|
|
|
||||||
LL | let _ = &mut encoded.clone();
|
|
||||||
| ^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
help: try dereferencing it
|
|
||||||
|
|
|
||||||
LL | let _ = &mut &(*encoded).clone();
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~
|
|
||||||
help: or try being explicit if you are sure, that you want to clone a reference
|
|
||||||
|
|
|
||||||
LL | let _ = &mut <&[u8]>::clone(encoded);
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: using `clone` on a double-reference; this will copy the reference of type `&[u8]` instead of cloning the inner type
|
|
||||||
--> $DIR/unnecessary_clone.rs:90:18
|
|
||||||
|
|
|
||||||
LL | let _ = &encoded.clone();
|
|
||||||
| ^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
help: try dereferencing it
|
|
||||||
|
|
|
||||||
LL | let _ = &&(*encoded).clone();
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~
|
|
||||||
help: or try being explicit if you are sure, that you want to clone a reference
|
|
||||||
|
|
|
||||||
LL | let _ = &<&[u8]>::clone(encoded);
|
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
error: using `.clone()` on a ref-counted pointer
|
error: using `.clone()` on a ref-counted pointer
|
||||||
--> $DIR/unnecessary_clone.rs:108:14
|
--> $DIR/unnecessary_clone.rs:95:14
|
||||||
|
|
|
|
||||||
LL | Some(try_opt!(Some(rc)).clone())
|
LL | Some(try_opt!(Some(rc)).clone())
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Rc::<u8>::clone(&try_opt!(Some(rc)))`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Rc::<u8>::clone(&try_opt!(Some(rc)))`
|
||||||
|
|
||||||
error: aborting due to 12 previous errors
|
error: aborting due to 9 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue