Skip to content

Commit 4b233c8

Browse files
committed
Auto merge of #6497 - matthiaskrgr:clone_1, r=flip1995
remove clone in manual_async_fn lint changelog: none
2 parents 51947df + af22613 commit 4b233c8

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

clippy_lints/src/manual_async_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualAsyncFn {
6969
|diag| {
7070
if_chain! {
7171
if let Some(header_snip) = snippet_opt(cx, header_span);
72-
if let Some(ret_pos) = position_before_rarrow(header_snip.clone());
72+
if let Some(ret_pos) = position_before_rarrow(&header_snip);
7373
if let Some((ret_sugg, ret_snip)) = suggested_ret(cx, output);
7474
then {
7575
let help = format!("make the function `async` and {}", ret_sugg);

clippy_lints/src/unused_unit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fn is_unit_expr(expr: &ast::Expr) -> bool {
120120

121121
fn lint_unneeded_unit_return(cx: &EarlyContext<'_>, ty: &ast::Ty, span: Span) {
122122
let (ret_span, appl) = if let Ok(fn_source) = cx.sess().source_map().span_to_snippet(span.with_hi(ty.span.hi())) {
123-
position_before_rarrow(fn_source).map_or((ty.span, Applicability::MaybeIncorrect), |rpos| {
123+
position_before_rarrow(&fn_source).map_or((ty.span, Applicability::MaybeIncorrect), |rpos| {
124124
(
125125
#[allow(clippy::cast_possible_truncation)]
126126
ty.span.with_lo(BytePos(span.lo().0 + rpos as u32)),

clippy_lints/src/utils/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,7 @@ pub fn indent_of<T: LintContext>(cx: &T, span: Span) -> Option<usize> {
788788
/// fn into3(self) -> () {}
789789
/// ^
790790
/// ```
791-
#[allow(clippy::needless_pass_by_value)]
792-
pub fn position_before_rarrow(s: String) -> Option<usize> {
791+
pub fn position_before_rarrow(s: &str) -> Option<usize> {
793792
s.rfind("->").map(|rpos| {
794793
let mut rpos = rpos;
795794
let chars: Vec<char> = s.chars().collect();

0 commit comments

Comments
 (0)