Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add support for custom allocator for String #101551

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

zachs18
Copy link
Contributor

@zachs18 zachs18 commented Sep 7, 2022

Roadmap for allocator support.

API Change Proposal: rust-lang/libs-team#101 [ Accepted ]

A subset/bring-to-current of #79500 utilizing a workaround(?) to the issue (#79499) that was blocking it.
(Note: I previously tried rebasing that (2 year old) PR onto current master, which was not my best idea).


Blocked on:

Todo/Unresolved Questions:

  • Fix UI tests. Done? (see my question below) (see Apparent duplicated diagnostic note for type mismatch involving type with defaulted type parameter. #101992)
  • Gdb/Lldb pretty-printing of String<A>.
  • Should From<String<A>> for Rc<str>/Arc be removed from this PR? (Corresponding impl does not exist for Vec/Rc<[T]>, and also it may preclude a future From<String<A>> for Rc<str, A>) removed
  • Should impl StructuralEq for String<_> be re-added? This PR removes it (because it no longer derive(Eq)), but it may not be observable because String: !StructuralPartialEq
    • Also for FromUtf8Error<_>, but that derived both PartialEq and Eq so it had both StructuralPartialEq and StructuralEq.
    • (Future: This will also will apply to CString, which derives PartialEq and Eq.)
  • impl<A: Allocator> From<String<A>> to Box<str, A> breaks orphan rules? (because Box and str are fundamental?)
  • Add better ways to make a new non-empty String<A>?
    • fn String<A>::from_str_in(s: &str, alloc: A) -> String<A>?
    • Likewise fn str::to_string_in(alloc: A) -> String<A> (parallels slice::to_vec_in)
    • Or maybe add to_string_in to ToString? (Probably a non-starter, since that would make ToString not object-safe, unless we put a where Self: Sized, which would preclude str)
  • [ ] Other FIXMEs (implement or remove comments) (removed FIXME comments, APIs moved to future work)

Possible Future work

  • How to handle from_utf8_lossy, which returns a non-allocator-aware Cow<str>?
  • How to handle from_utf16(_lossy), which return String and Result<String, _>?
  • (If specialization like this is sound), From<Cow<str>> for String<A> where A: Default could be implemented as from_str_in(&*cow, A::default()) , and specialized for A = Global to the current implementation cow.into_owned().
  • From<&String<A>> for String<A> where A: Clone or From<&String<A>> for String<B> where B: Default (I don't think both can exist).
  • FromIterator<_> for String, FromStr for String, and From<&str-like> for String could be for String<A> where A: Default.
  • impl const Default for String could be impl<A: _ + ~const Default> Default for String<A>, except that Global doesn't implement const Default currently (but I don't see any reason it couldn't).

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 7, 2022
@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 7, 2022
@rust-log-analyzer

This comment has been minimized.

Comment on lines 7 to 11
| | expected struct `String`, found `&String`
| arguments to this function are incorrect
|
= note: expected struct `String`
found reference `&String`
Copy link
Contributor Author

@zachs18 zachs18 Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR changed a lot of the UI tests/diagnostics to have duplicated-ish note messages. I don't know enough about the diagnostics system to really understand why. Are these changes acceptable?

(Several similar changes, e.g. expected struct String, found type str in src/test/ui/issues/issue-53348.stderr, expected struct String, found unit type () in src/test/ui/block-result/consider-removing-last-semi.stderr)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that #79500 had the same kind of duplicated-ish note messages, e.g..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't know the cause here, but it feels like it might be a larger bug -- maybe worth trying to reproduce on stable/nightly outside of the String type (e.g., have a struct and add a generic parameter to it) and see if that causes similar behavior on regular rustc compilers? If so, then you could file an issue for that.

If this is something specific to String that's probably worth poking at too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not appear to be specific to String; I have opened #101992 about it.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@zachs18
Copy link
Contributor Author

zachs18 commented Sep 10, 2022

Things that are the same as 79500:

The following were made allocator-aware (or added) in the same way as in 79500:

  • alloc::str::from_boxed_utf8_unchecked
  • alloc::string::String<A>
    • from_utf8(_unchecked), alloc::string::FromUtf8Error and all impls.
    • add from_raw_parts_in/into_raw_parts_with_alloc (from_raw_parts/into_raw_parts stay in String<Global>, unlike for Vec::into_raw_parts currently)
    • add new_in/with_capacity_in
    • into_bytes/as_mut_vec
    • split_off where A: Clone
    • drain, alloc::string::Drain and all impls,
    • Display/Debug/Hash
    • Clone where A: Clone
    • Extend<.*>/fmt::Write
    • Pattern
    • PartialEq to other string-like types (Cow<str>, str, &str)
    • Add(Assign)<&str>
    • Index(Mut)/Deref(Mut)
    • From<Box<str, A>> for String<A>
    • From<String<A>> for Vec<u8, A>

DIfferences from 79500 :

  • This does not add String::from_utf16_in.
  • This implements PartialEq and PartialOrd between Strings of different allocators.
  • This manually implements PartialOrd, Eq, Ord (where 79500 derived these) to avoid an A: Eq (etc) bound.
    • This does not implement StructuralEq anymore.
    • (79500 made deriving work by implementing (Partial){Eq,Ord} for Global. This does not add or require those implementations.)
  • This does not currently implement From<&String<A>> for String<A> where A: Clone in case we would want From<&String<A2>> for String<A1> where A1: Default.
  • This does not currently implement From<String<A>> for Box<str, A> (because of orphan rules? A is an uncovered type parameter, because Box is fundamental?).

Additions from 79500:

  • This adds String::allocator à la Vec::allocator
  • This makes AsRef<str>/AsMut<str>/AsRef<[u8]> for String allocator-generic.
  • This implements ToString for String<A> (using <str as ToOwned>::to_owned instead of the current <String as ToOwned>::to_owned, which clones the String)

@zachs18 zachs18 marked this pull request as ready for review September 10, 2022 20:26
@rustbot
Copy link
Collaborator

rustbot commented Sep 10, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@zachs18
Copy link
Contributor Author

zachs18 commented Sep 10, 2022

It passes the checks now, so I'm marking this as ready for review. Feedback is appreciated! (especially on the unresolved questions in the Todos).

(CC'ing people from 79500)
cc @Amanieu , @TimDiekmann

@zachs18
Copy link
Contributor Author

zachs18 commented Sep 10, 2022

(I think this is right?)
@rustbot label +T-libs-api -T-libs
(I don't know if this needs an API change proposal since it has a tracking issue?) ACP: rust-lang/libs-team#101

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 10, 2022
#[inline]
#[unstable(feature = "allocator_api", issue = "32838")]
#[must_use]
pub fn with_capacity_in(capacity: usize, alloc: A) -> String<A> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sort of feel like we shouldn't provide these APIs and instead encourage String::from(Vec::with_capacity_in(....)), since they do add noise to documentation and most users aren't using them. But that can be handled at stabilization time, I suppose, and is a broader question about everything being allocator-generic.


#[cfg(not(no_global_oom_handling))]
#[stable(feature = "from_char_for_string", since = "1.46.0")]
impl From<char> for String {
// FIXME(zachs18): A: Allocator + Default?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should add this comment; there's many APIs which could do this (even on Vec) and it doesn't seem worth leaving comments strewn around std for that future possibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I had intended to remove or implement most of the FIXMEs based on feedback before the PR gets merged. I'll just remove the ones that don't currently exist for Vec for this PR.

@Mark-Simulacrum
Copy link
Member

A few notes:

String no longer implementing StructuralEq

I think this is not observable on stable, though I'm not entirely confident. The primary area where it matters that I know of is pattern matching with a const value, but that requires StructuralPartialEq too.

FromUtf8Error<_>, but that derived both PartialEq and Eq so it had both StructuralPartialEq and StructuralEq.

In order to check whether this is a breaking change we need to know whether any const context on stable can get the value -- I think the answer may be no, but I'm not confident.


Also left some comments inline, going to @rustbot author for now but please mark it as ready for review if the ACP goes through and you have addressed comments (or posted back with questions).

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 17, 2022
library/alloc/src/rc.rs Outdated Show resolved Hide resolved
library/alloc/src/sync.rs Outdated Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

@zachs18
Copy link
Contributor Author

zachs18 commented Jan 2, 2023

This is still (somewhat) blocked on the duplicate diagnostic issue (#101992).

Also, unless the semantics around how generic defaults affect inference are changed (e.g. to allow String to default to String::<Global> in paths), it may be a problem that things like this (playground link) with let _ = String::ASSOC_CONST_FROM_TRAIT; or let _ = String::assoc_fn_nonmethod(); don't compile. I don't think this can actually break any existing code, because it would only break if the trait(/associated function) is implemented for String<A> for multiple allocators A (not just A = Global), but I think there are no such impls (String::new/Default/FromStr/FromIterator/From/etc should still only be implemented for String<Global> in this PR). (I vaguely remember some UI test failing because of this, but it's not happening locally in my rebase; maybe it'll pop up in CI). (related: #101319 and #98931)

Edit: Yup, the test failure i half-remembered was library/core/src/mem/mod.rs:1271. Anything like this, with a blanket implementation that applies to String<A> for multiple A will cause problems.

trait MySized { const SIZE: usize; }
impl<T: Sized> MySized for T {
  const SIZE: usize = std::mem::size_of::<Self>();
}
fn main() {
  dbg!(String::SIZE); // Fails under this PR
}

So this PR is a breaking change unless the default generic parameter issue is resolved.

I just rebased today, and there are some UI test changes that I have questions about: (see later inline comments).

@zachs18

This comment was marked as outdated.

@rustbot rustbot added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 2, 2023
@rust-log-analyzer

This comment has been minimized.

@Dylan-DPC Dylan-DPC removed the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label May 16, 2023
@Dylan-DPC Dylan-DPC added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. labels Jul 26, 2023
@Dylan-DPC Dylan-DPC added S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. labels Oct 7, 2023
More `allocator_api`-aware `String` implementations (Most allocator-irrelevant associated functions, Drain, and FromUtf8Error).

More `allocator_api`-aware `String` implementations, including added `new_in` etc inherent impls.

tidy, new_in etc, raw_parts_in etc, allocator(&self), FromUtf8Error impls, Extend, Pattern, PartialEq &str etc with String<A>, Display, Debug, Hash, Add(Assign), ToString, AsRef/AsMut, conversions Box<str, A> -> String<A>, &String -> Cow<str>, String<A> -> Vec<u8, A>; fmt::Write.

Update some UI tests (just ones that only added allocator generic).

Note from rebase: look back at:
src/test/ui/lexer/lex-bad-char-literals-6.stderr
src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr
src/test/ui/inference/issue-72690.stderr
src/test/ui/typeck/issue-104582.stderr

Update UI tests that had significant changes.

Fix gdb/lldb integration for String<A>.

Add some simple trait impls I missed.

Borrow(Mut)<str> for String, From<String<A>> for Rc<str>/Arc<str>, Clone for Box<str, A>.

Remove FIXMEs for String<A> APIs that don't already exist for Vec<T,A>.

Rewrite `Clone for Box<str, A>` to avoid extra capacity/length checks converting from Vec.

Also implement `clone_from` to re-use the allocation when the lengths are the same.

Remove `From<String<A>> for Rc<str>`/`Arc` impls to allow for future alloc-ification of `Rc`/`Arc`

Rebase: fix UI tests.

Note: find out how to make "the full type name has been written to" errors be deterministic (./x.py test alone didn't do it).

AsRef<OsStr> and AsRef<Path> for String<A: Allocator>
@zachs18
Copy link
Contributor Author

zachs18 commented Jan 19, 2024

Because of the "defaults-don't-affect-type-inference" issue, alloc::string::String currently must be a concrete non-generic type (or things like String::ASSOC_CONST fail).
The latest push moves String to alloc::string::string::String (where alloc::string::string is an unstable module under the (new) string_allocator_api unstable feature), and makes alloc::string::String a type alias to alloc::string::string::String<Global>. Similar for Drain, and FromUtf8Error.

FromUtf16Error is not made generic by this PR, so I just used a pub use. ToString only works with Global anyway, so I left it in alloc::string.

"defaults-don't-affect-type-inference" will probably still block stabilizing allocator_api support for String, but with this it can now be used on nightly at least.

(Waiting for CI before marking as ready)

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ACTION=__run_7
GITHUB_ACTIONS=true
GITHUB_ACTION_REF=
GITHUB_ACTION_REPOSITORY=
GITHUB_ACTOR=zachs18
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=master
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_783fdefb-3d93-47c5-8498-d3eb3dd5a371
GITHUB_EVENT_NAME=pull_request
---
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=0ba061eb7a70db7d0b61b28b1f2a28425e6fc605
GITHUB_STATE=/home/runner/work/_temp/_runner_file_commands/save_state_783fdefb-3d93-47c5-8498-d3eb3dd5a371
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_783fdefb-3d93-47c5-8498-d3eb3dd5a371
GITHUB_TRIGGERING_ACTOR=zachs18
GITHUB_WORKFLOW_REF=rust-lang/rust/.github/workflows/ci.yml@refs/pull/101551/merge
GITHUB_WORKFLOW_SHA=0ba061eb7a70db7d0b61b28b1f2a28425e6fc605
GITHUB_WORKSPACE=/home/runner/work/rust/rust
GOROOT_1_19_X64=/opt/hostedtoolcache/go/1.19.13/x64
---

     Running tests/compile-test.rs (obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/compile_test-b64dd5970b05eb25)

FAILED TEST: tests/ui/box_collection.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/box_collection.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/box_collection.stderr` to the actual output
--- tests/ui/box_collection.stderr
+++ <stderr output>
+++ <stderr output>
 error: you seem to be trying to use `Box<Vec<..>>`. Consider using just `Vec<..>`
... 6 lines skipped ...
    = help: to override `-D warnings` add `#[allow(clippy::box_collection)]`
 
 
-error: you seem to be trying to use `Box<String>`. Consider using just `String`
-   |
-LL | fn test3(foo: Box<String>) {}
-   |               ^^^^^^^^^^^
-   |
-   |
-   = help: `String` is already on the heap, `Box<String>` makes an extra allocation
-
 error: you seem to be trying to use `Box<HashMap<..>>`. Consider using just `HashMap<..>`
... 52 lines skipped ...
... 52 lines skipped ...
    = help: `BinaryHeap<..>` is already on the heap, `Box<BinaryHeap<..>>` makes an extra allocation
-error: aborting due to 9 previous errors
+error: aborting due to 8 previous errors
 



error: `you seem to be trying to use `Box<String>`. Consider using just `String`` not found in diagnostics on line 29
   |
   |
30 | //~^ ERROR: you seem to be trying to use `Box<String>`. Consider using just `String`
   |

full stderr:
full stderr:
error: you seem to be trying to use `Box<Vec<..>>`. Consider using just `Vec<..>`
   |
   |
LL | fn test1(foo: Box<Vec<bool>>) {}
   |
   |
   = help: `Vec<..>` is already on the heap, `Box<Vec<..>>` makes an extra allocation
   = note: `-D clippy::box-collection` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::box_collection)]`

error: you seem to be trying to use `Box<HashMap<..>>`. Consider using just `HashMap<..>`
   |
   |
LL | fn test4(foo: Box<HashMap<String, String>>) {}
   |
   |
   = help: `HashMap<..>` is already on the heap, `Box<HashMap<..>>` makes an extra allocation

error: you seem to be trying to use `Box<HashSet<..>>`. Consider using just `HashSet<..>`
   |
   |
LL | fn test5(foo: Box<HashSet<i64>>) {}
   |
   |
   = help: `HashSet<..>` is already on the heap, `Box<HashSet<..>>` makes an extra allocation

error: you seem to be trying to use `Box<VecDeque<..>>`. Consider using just `VecDeque<..>`
   |
   |
LL | fn test6(foo: Box<VecDeque<i32>>) {}
   |
   |
   = help: `VecDeque<..>` is already on the heap, `Box<VecDeque<..>>` makes an extra allocation

error: you seem to be trying to use `Box<LinkedList<..>>`. Consider using just `LinkedList<..>`
   |
   |
LL | fn test7(foo: Box<LinkedList<i16>>) {}
   |
   |
   = help: `LinkedList<..>` is already on the heap, `Box<LinkedList<..>>` makes an extra allocation

error: you seem to be trying to use `Box<BTreeMap<..>>`. Consider using just `BTreeMap<..>`
   |
   |
LL | fn test8(foo: Box<BTreeMap<i8, String>>) {}
   |
   |
   = help: `BTreeMap<..>` is already on the heap, `Box<BTreeMap<..>>` makes an extra allocation

error: you seem to be trying to use `Box<BTreeSet<..>>`. Consider using just `BTreeSet<..>`
   |
   |
LL | fn test9(foo: Box<BTreeSet<u64>>) {}
   |
   |
   = help: `BTreeSet<..>` is already on the heap, `Box<BTreeSet<..>>` makes an extra allocation

error: you seem to be trying to use `Box<BinaryHeap<..>>`. Consider using just `BinaryHeap<..>`
   |
   |
LL | fn test10(foo: Box<BinaryHeap<u32>>) {}
   |
   |
   = help: `BinaryHeap<..>` is already on the heap, `Box<BinaryHeap<..>>` makes an extra allocation
error: aborting due to 8 previous errors


full stdout:
full stdout:



FAILED TEST: tests/ui/box_default.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/box_default.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/box_default.stderr` to the actual output
--- tests/ui/box_default.stderr
+++ <stderr output>
+++ <stderr output>
 error: `Box::new(_)` of default value
... 42 lines skipped ...
 
 
 error: `Box::new(_)` of default value
-   |
-   |
-LL |     let _string_default = outer!(Box::new(String::from("")));
-   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<String>::default()`
-
-error: `Box::new(_)` of default value
    |
... 43 lines skipped ...
... 43 lines skipped ...
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<Foo>::default()`
-error: aborting due to 16 previous errors
+error: aborting due to 15 previous errors
 



full stderr:
error: `Box::new(_)` of default value
   |
LL |     let _string: Box<String> = Box::new(Default::default());
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
   |
   |
   = note: `-D clippy::box-default` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::box_default)]`

error: `Box::new(_)` of default value
   |
   |
LL |     let _byte = Box::new(u8::default());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<u8>::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     let _vec = Box::new(Vec::<u8>::new());
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<Vec<u8>>::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     let _impl = Box::new(ImplementsDefault::default());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<ImplementsDefault>::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     let _impl2 = Box::new(<ImplementsDefault as Default>::default());
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<ImplementsDefault>::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     let _impl3: Box<ImplementsDefault> = Box::new(Default::default());
   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     let _in_macro = outer!(Box::new(String::new()));
   |                            ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<String>::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     let _vec2: Box<Vec<ImplementsDefault>> = Box::new(vec![]);
   |                                              ^^^^^^^^^^^^^^^^ help: try: `Box::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     let _vec3: Box<Vec<bool>> = Box::new(Vec::from([]));
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     let _vec4: Box<_> = Box::new(Vec::from([false; 0]));
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<Vec<bool>>::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     call_ty_fn(Box::new(u8::default()));
   |                ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`

error: `Box::new(_)` of default value
   |
LL |     Box::new(bool::default())
LL |     Box::new(bool::default())
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<bool>::default()`

error: `Box::new(_)` of default value
   |
   |
LL |     let _: Box<dyn Read> = Box::new(ImplementsDefault::default());
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<ImplementsDefault>::default()`

error: `Box::new(_)` of default value
   |
   |
LL |         let _ = Box::new(WeirdPathed::default());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<WeirdPathed>::default()`

error: `Box::new(_)` of default value
   |
LL |             Some(Box::new(Foo::default()))
LL |             Some(Box::new(Foo::default()))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<Foo>::default()`
error: aborting due to 15 previous errors


full stdout:
full stdout:



FAILED TEST: tests/ui/arithmetic_side_effects.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/arithmetic_side_effects.rs" "--edition" "2021" "--extern" "proc_macro_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui/auxiliary/libproc_macro_derive.so" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui/auxiliary"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/arithmetic_side_effects.stderr` to the actual output
--- tests/ui/arithmetic_side_effects.stderr
+++ <stderr output>
+++ <stderr output>
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:304:5
+  --> $DIR/arithmetic_side_effects.rs:169:13
    |
-LL |     _n += 1;
+LL |     let _ = String::new() + "";
+   |             ^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]`
    = help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]`
 
 error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:177:27
+LL |     let inferred_string = string + "";
+   |                           ^^^^^^^^^^^
+
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:181:13
+   |
+LL |     let _ = inferred_string + "";
+
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:304:5
+   |
+LL |     _n += 1;
+
+
+error: arithmetic operation that can potentially result in unexpected side-effects
   --> $DIR/arithmetic_side_effects.rs:305:5
... 703 lines skipped ...
    |         ^^^^^^^^^^^^^^
 
-error: aborting due to 119 previous errors
-error: aborting due to 119 previous errors
+error: aborting due to 122 previous errors
 


full stderr:
error: arithmetic operation that can potentially result in unexpected side-effects
   |
LL |     let _ = String::new() + "";
   |             ^^^^^^^^^^^^^^^^^^
   |
   |
   = 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
   |
LL |     let inferred_string = string + "";
   |                           ^^^^^^^^^^^


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     let _ = inferred_string + "";


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n += 1;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n += &1;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n -= 1;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n -= &1;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n /= 0;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n /= &0;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n %= 0;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n %= &0;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n *= 2;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n *= &2;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n += -1;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n += &-1;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n -= -1;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n -= &-1;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n /= -0;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n /= &-0;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n %= -0;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n %= &-0;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n *= -2;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _n *= &-2;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
LL |     _custom += Custom;
   |     ^^^^^^^^^^^^^^^^^


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom += &Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom -= Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom -= &Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom /= Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom /= &Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom %= Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom %= &Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom *= Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom *= &Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
   |
   |
LL |     _custom >>= Custom;


error: arithmetic operation that can potentially result in unexpected side-effects
---
-   |
-LL |     string.push_str(&format!("{:?}", 5678));
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: consider using `write!` to avoid the extra allocation
-error: `format!(..)` appended to existing `String`
   --> $DIR/format_push_string.rs:15:13
    |
... 33 lines skipped ...
... 33 lines skipped ...
    = help: consider using `write!` to avoid the extra allocation
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 



error: ``format!(..)` appended to existing `String`` not found in diagnostics on line 7
  |
  |
8 |     //~^ ERROR: `format!(..)` appended to existing `String`
  |

full stderr:
error: `format!(..)` appended to existing `String`
error: `format!(..)` appended to existing `String`
##[error]  --> tests/ui/format_push_string.rs:5:5
   |
LL |     string += &format!("{:?}", 1234);
   |
   |
   = help: consider using `write!` to avoid the extra allocation
   = note: `-D clippy::format-push-string` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::format_push_string)]`
error: `format!(..)` appended to existing `String`
##[error]  --> tests/ui/format_push_string.rs:15:13
   |
   |
LL | /             hex += &(if upper {
LL | |
LL | |                 format!("{byte:02X}")
LL | |             } else {
LL | |                 format!("{byte:02x}")
   | |______________^
   |
   |
   = help: consider using `write!` to avoid the extra allocation
error: `format!(..)` appended to existing `String`
##[error]  --> tests/ui/format_push_string.rs:28:9
   |
   |
LL | /         s += &(if let Some(_a) = Some(1234) {
LL | |             format!("{}", 1234)
LL | |         } else {
LL | |             format!("{}", 1234)
LL | |         });
LL | |         });
   | |__________^
   |
   = help: consider using `write!` to avoid the extra allocation
error: `format!(..)` appended to existing `String`
##[error]  --> tests/ui/format_push_string.rs:35:9
   |
   |
LL | /         s += &(match Some(1234) {
LL | |
LL | |             Some(_) => format!("{}", 1234),
LL | |             None => format!("{}", 1234),
   | |__________^
   |
   |
   = help: consider using `write!` to avoid the extra allocation
error: aborting due to 4 previous errors


full stdout:
full stdout:



FAILED TEST: tests/ui/from_over_into.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/from_over_into.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/from_over_into.stderr` to the actual output
--- tests/ui/from_over_into.stderr
+++ <stderr output>
+++ <stderr output>
 error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
... 4 lines skipped ...
    = note: `-D clippy::from-over-into` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::from_over_into)]`
    = help: to override `-D warnings` add `#[allow(clippy::from_over_into)]`
-help: replace the `Into` implementation with `From<std::string::String>`
+help: replace the `Into` implementation with `From<std::string::string::String>`
    |
 LL ~ impl From<String> for StringWrapper {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    |
-help: replace the `Into` implementation with `From<std::string::String>`
+help: replace the `Into` implementation with `From<std::string::string::String>`
    |
 LL ~ impl From<String> for SelfType {
 error: aborting due to 6 previous errors
 



full stderr:
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
   |
LL | impl Into<StringWrapper> for String {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = note: `-D clippy::from-over-into` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::from_over_into)]`
help: replace the `Into` implementation with `From<std::string::string::String>`
   |
LL ~ impl From<String> for StringWrapper {
LL ~     fn from(val: String) -> Self {
LL ~         StringWrapper(val)


error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
   |
LL | impl Into<SelfType> for String {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
help: replace the `Into` implementation with `From<std::string::string::String>`
   |
LL ~ impl From<String> for SelfType {
LL ~     fn from(val: String) -> Self {
LL ~         SelfType(String::new())


error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
   |
   |
LL | impl Into<SelfKeywords> for X {
   |
   |
help: replace the `Into` implementation with `From<X>`
   |
LL ~ impl From<X> for SelfKeywords {
LL ~     fn from(val: X) -> Self {
LL ~         let _ = X;
LL ~         let _ = X::FOO;
LL ~         let _: X = val;


error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
   |
   |
LL | impl core::convert::Into<bool> for crate::ExplicitPaths {
   |
   |
   = help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
           https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
help: replace the `Into` implementation with `From<ExplicitPaths>`
   |
LL ~ impl core::convert::From<crate::ExplicitPaths> for bool {
LL ~     fn from(mut val: crate::ExplicitPaths) -> Self {
LL ~         let in_closure = || val.0;
LL | 
LL ~         val.0 = false;
LL ~         val.0


error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
   |
LL | impl Into<String> for PathInExpansion {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
           https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
help: replace the `Into` implementation with `From<PathInExpansion>`
   |
LL ~ impl From<PathInExpansion> for String {
LL ~     fn from(val: PathInExpansion) -> Self {


error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
   |
   |
LL |     impl<T> Into<FromOverInto<T>> for Vec<T> {
   |
   |
help: replace the `Into` implementation with `From<std::vec::Vec<T>>`
   |
LL ~     impl<T> From<Vec<T>> for FromOverInto<T> {
LL ~         fn from(val: Vec<T>) -> Self {
LL ~             FromOverInto(val)

error: aborting due to 6 previous errors



full stdout:



FAILED TEST: tests/ui/inefficient_to_string.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/inefficient_to_string.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/inefficient_to_string.stderr` to the actual output
--- tests/ui/inefficient_to_string.stderr
+++ <stderr output>
+++ <stderr output>
 error: calling `to_string` on `&&str`
   --> $DIR/inefficient_to_string.rs:10:21
... 17 lines skipped ...
    = help: `&&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
 
-error: calling `to_string` on `&&std::string::String`
+error: calling `to_string` on `&&std::string::string::String`
   --> $DIR/inefficient_to_string.rs:19:21
    |
 LL |     let _: String = rrstring.to_string();
    |                     ^^^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrstring).to_string()`
    |
-   = help: `&std::string::String` implements `ToString` through a slower blanket impl, but `std::string::String` has a fast specialization of `ToString`
+   = help: `&std::string::string::String` implements `ToString` through a slower blanket impl, but `std::string::string::String` has a fast specialization of `ToString`
 
-error: calling `to_string` on `&&&std::string::String`
+error: calling `to_string` on `&&&std::string::string::String`
   --> $DIR/inefficient_to_string.rs:20:21
    |
 LL |     let _: String = rrrstring.to_string();
    |                     ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrstring).to_string()`
    |
-   = help: `&&std::string::String` implements `ToString` through a slower blanket impl, but `std::string::String` has a fast specialization of `ToString`
+   = help: `&&std::string::string::String` implements `ToString` through a slower blanket impl, but `std::string::string::String` has a fast specialization of `ToString`
 
 error: calling `to_string` on `&&std::borrow::Cow<'_, str>`
 error: aborting due to 6 previous errors
 



full stderr:
error: calling `to_string` on `&&str`
   |
   |
LL |     let _: String = rrstr.to_string();
   |                     ^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrstr).to_string()`
   |
   = help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
  --> tests/ui/inefficient_to_string.rs:1:9
   |
LL | #![deny(clippy::inefficient_to_string)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: calling `to_string` on `&&&str`
   |
   |
LL |     let _: String = rrrstr.to_string();
   |                     ^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrstr).to_string()`
   |
   = help: `&&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`

error: calling `to_string` on `&&std::string::string::String`
   |
   |
LL |     let _: String = rrstring.to_string();
   |                     ^^^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrstring).to_string()`
   |
   = help: `&std::string::string::String` implements `ToString` through a slower blanket impl, but `std::string::string::String` has a fast specialization of `ToString`

error: calling `to_string` on `&&&std::string::string::String`
   |
   |
LL |     let _: String = rrrstring.to_string();
   |                     ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrstring).to_string()`
   |
   = help: `&&std::string::string::String` implements `ToString` through a slower blanket impl, but `std::string::string::String` has a fast specialization of `ToString`

error: calling `to_string` on `&&std::borrow::Cow<'_, str>`
   |
   |
LL |     let _: String = rrcow.to_string();
   |                     ^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrcow).to_string()`
   |
   = help: `&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString`

error: calling `to_string` on `&&&std::borrow::Cow<'_, str>`
   |
   |
LL |     let _: String = rrrcow.to_string();
   |                     ^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrcow).to_string()`
   |
   = help: `&&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString`
error: aborting due to 6 previous errors


full stdout:
full stdout:



FAILED TEST: tests/ui/mem_forget.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/mem_forget.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/mem_forget.stderr` to the actual output
--- tests/ui/mem_forget.stderr
+++ <stderr output>
---
 error: aborting due to 4 previous errors
 


error: `argument has type `std::string::String`` not found in diagnostics on line 29
   |
   |
31 |     //~| NOTE: argument has type `std::string::String`
   |

full stderr:
error: usage of `mem::forget` on `Drop` type
error: usage of `mem::forget` on `Drop` type
##[error]  --> tests/ui/mem_forget.rs:14:5
   |
LL |     memstuff::forget(six);
   |
   = note: argument has type `std::sync::Arc<i32>`
   = note: `-D clippy::mem-forget` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::mem_forget)]`
   = help: to override `-D warnings` add `#[allow(clippy::mem_forget)]`

error: usage of `mem::forget` on `Drop` type
##[error]  --> tests/ui/mem_forget.rs:19:5
   |
LL |     std::mem::forget(seven);
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: argument has type `std::rc::Rc<i32>`
error: usage of `mem::forget` on `Drop` type
##[error]  --> tests/ui/mem_forget.rs:24:5
   |
   |
LL |     forgetSomething(eight);
   |
   = note: argument has type `std::vec::Vec<i32>`

error: usage of `mem::forget` on type with `Drop` fields
---



FAILED TEST: tests/ui/option_as_ref_deref.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/option_as_ref_deref.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/option_as_ref_deref.stderr` to the actual output
--- tests/ui/option_as_ref_deref.stderr
+++ <stderr output>
+++ <stderr output>
 error: called `.as_ref().map(Deref::deref)` on an `Option` value
... 21 lines skipped ...
... 21 lines skipped ...
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
 
-error: called `.as_ref().map(String::as_str)` on an `Option` value
-   |
-   |
-LL |     let _ = opt.as_ref().map(String::as_str);
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
-
-error: called `.as_ref().map(|x| x.as_str())` on an `Option` value
-   |
-   |
-LL |     let _ = opt.as_ref().map(|x| x.as_str());
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
-
-error: called `.as_mut().map(String::as_mut_str)` on an `Option` value
-   |
-   |
-LL |     let _ = opt.as_mut().map(String::as_mut_str);
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
-
-error: called `.as_mut().map(|x| x.as_mut_str())` on an `Option` value
-   |
-   |
-LL |     let _ = opt.as_mut().map(|x| x.as_mut_str());
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
-
 error: called `.as_ref().map(CString::as_c_str)` on an `Option` value
... 56 lines skipped ...
... 56 lines skipped ...
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
 
-error: called `.as_ref().map(String::as_str)` on an `Option` value
 
-error: aborting due to 18 previous errors
-



full stderr:
error: called `.as_ref().map(Deref::deref)` on an `Option` value
   |
   |
LL |     let _ = opt.clone().as_ref().map(Deref::deref).map(str::len);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.clone().as_deref()`
   = note: `-D clippy::option-as-ref-deref` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::option_as_ref_deref)]`


error: called `.as_ref().map(Deref::deref)` on an `Option` value
   |
LL |       let _ = opt.clone()
   |  _____________^
LL | |         .as_ref().map(
LL | |         .as_ref().map(
LL | |             Deref::deref
LL | |         )
   | |_________^ help: try using as_deref instead: `opt.clone().as_deref()`

error: called `.as_mut().map(DerefMut::deref_mut)` on an `Option` value
   |
   |
LL |     let _ = opt.as_mut().map(DerefMut::deref_mut);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`

error: called `.as_ref().map(CString::as_c_str)` on an `Option` value
   |
   |
LL |     let _ = Some(CString::new(vec![]).unwrap()).as_ref().map(CString::as_c_str);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(CString::new(vec![]).unwrap()).as_deref()`

error: called `.as_ref().map(OsString::as_os_str)` on an `Option` value
   |
   |
LL |     let _ = Some(OsString::new()).as_ref().map(OsString::as_os_str);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(OsString::new()).as_deref()`

error: called `.as_ref().map(PathBuf::as_path)` on an `Option` value
   |
LL |     let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
LL |     let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(PathBuf::new()).as_deref()`

error: called `.as_ref().map(Vec::as_slice)` on an `Option` value
   |
   |
LL |     let _ = Some(Vec::<()>::new()).as_ref().map(Vec::as_slice);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(Vec::<()>::new()).as_deref()`

error: called `.as_mut().map(Vec::as_mut_slice)` on an `Option` value
   |
   |
LL |     let _ = Some(Vec::<()>::new()).as_mut().map(Vec::as_mut_slice);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `Some(Vec::<()>::new()).as_deref_mut()`

error: called `.as_ref().map(|x| x.deref())` on an `Option` value
   |
   |
LL |     let _ = opt.as_ref().map(|x| x.deref());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`

error: called `.as_mut().map(|x| x.deref_mut())` on an `Option` value
   |
   |
LL |     let _ = opt.clone().as_mut().map(|x| x.deref_mut()).map(|x| x.len());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.clone().as_deref_mut()`

error: called `.as_ref().map(|x| &**x)` on an `Option` value
   |
   |
LL |     let _ = opt.as_ref().map(|x| &**x);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`

error: called `.as_mut().map(|x| &mut **x)` on an `Option` value
   |
   |
LL |     let _ = opt.as_mut().map(|x| &mut **x);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`

error: called `.as_ref().map(std::ops::Deref::deref)` on an `Option` value
   |
LL |     let _ = opt.as_ref().map(std::ops::Deref::deref);
LL |     let _ = opt.as_ref().map(std::ops::Deref::deref);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
error: aborting due to 13 previous errors


full stdout:
full stdout:



FAILED TEST: tests/ui/rc_buffer.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/rc_buffer.rs" "--edition" "2021"
error: actual output differed from expected
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/rc_buffer.stderr` to the actual output
--- tests/ui/rc_buffer.stderr
+++ <stderr output>
 error: usage of `Rc<T>` when T is a buffer type
-  --> $DIR/rc_buffer.rs:11:11
+  --> $DIR/rc_buffer.rs:12:11
-LL |     bad1: Rc<String>,
+LL |     bad2: Rc<PathBuf>,
-   |           ^^^^^^^^^^ help: try: `Rc<str>`
+   |           ^^^^^^^^^^^ help: try: `Rc<std::path::Path>`
+   |           ^^^^^^^^^^^ help: try: `Rc<std::path::Path>`
    |
    = note: `-D clippy::rc-buffer` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::rc_buffer)]`
 
 error: usage of `Rc<T>` when T is a buffer type
-  --> $DIR/rc_buffer.rs:12:11
-LL |     bad2: Rc<PathBuf>,
-   |           ^^^^^^^^^^^ help: try: `Rc<std::path::Path>`
-
-
-error: usage of `Rc<T>` when T is a buffer type
   --> $DIR/rc_buffer.rs:13:11
... 8 lines skipped ...
 
 
 error: usage of `Rc<T>` when T is a buffer type
-  --> $DIR/rc_buffer.rs:20:17
-   |
-LL | fn func_bad1(_: Rc<String>) {}
-   |                 ^^^^^^^^^^ help: try: `Rc<str>`
-
-error: usage of `Rc<T>` when T is a buffer type
   --> $DIR/rc_buffer.rs:21:17
... 13 lines skipped ...
    |                 ^^^^^^^^^^^^ help: try: `Rc<std::ffi::OsStr>`
 
-error: aborting due to 8 previous errors
-error: aborting due to 8 previous errors
+error: aborting due to 6 previous errors
 


full stderr:
error: usage of `Rc<T>` when T is a buffer type
   |
LL |     bad2: Rc<PathBuf>,
   |           ^^^^^^^^^^^ help: try: `Rc<std::path::Path>`
   |
   |
   = note: `-D clippy::rc-buffer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::rc_buffer)]`

error: usage of `Rc<T>` when T is a buffer type
   |
   |
LL |     bad3: Rc<Vec<u8>>,
   |           ^^^^^^^^^^^ help: try: `Rc<[u8]>`

error: usage of `Rc<T>` when T is a buffer type
   |
LL |     bad4: Rc<OsString>,
   |           ^^^^^^^^^^^^ help: try: `Rc<std::ffi::OsStr>`


error: usage of `Rc<T>` when T is a buffer type
   |
   |
LL | fn func_bad2(_: Rc<PathBuf>) {}
   |                 ^^^^^^^^^^^ help: try: `Rc<std::path::Path>`

error: usage of `Rc<T>` when T is a buffer type
   |
   |
LL | fn func_bad3(_: Rc<Vec<u8>>) {}
   |                 ^^^^^^^^^^^ help: try: `Rc<[u8]>`

error: usage of `Rc<T>` when T is a buffer type
   |
   |
LL | fn func_bad4(_: Rc<OsString>) {}
   |                 ^^^^^^^^^^^^ help: try: `Rc<std::ffi::OsStr>`
error: aborting due to 6 previous errors


full stdout:
full stdout:



FAILED TEST: tests/ui/rc_buffer_arc.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/rc_buffer_arc.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/rc_buffer_arc.stderr` to the actual output
--- tests/ui/rc_buffer_arc.stderr
+++ <stderr output>
+++ <stderr output>
 error: usage of `Arc<T>` when T is a buffer type
-  --> $DIR/rc_buffer_arc.rs:10:11
+  --> $DIR/rc_buffer_arc.rs:11:11
-LL |     bad1: Arc<String>,
+LL |     bad2: Arc<PathBuf>,
-   |           ^^^^^^^^^^^ help: try: `Arc<str>`
+   |           ^^^^^^^^^^^^ help: try: `Arc<std::path::Path>`
+   |           ^^^^^^^^^^^^ help: try: `Arc<std::path::Path>`
    |
    = note: `-D clippy::rc-buffer` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::rc_buffer)]`
 
 error: usage of `Arc<T>` when T is a buffer type
-  --> $DIR/rc_buffer_arc.rs:11:11
-LL |     bad2: Arc<PathBuf>,
-   |           ^^^^^^^^^^^^ help: try: `Arc<std::path::Path>`
-
-
-error: usage of `Arc<T>` when T is a buffer type
   --> $DIR/rc_buffer_arc.rs:12:11
... 8 lines skipped ...
 
 
 error: usage of `Arc<T>` when T is a buffer type
-  --> $DIR/rc_buffer_arc.rs:19:17
-   |
-LL | fn func_bad1(_: Arc<String>) {}
-   |                 ^^^^^^^^^^^ help: try: `Arc<str>`
-
-error: usage of `Arc<T>` when T is a buffer type
   --> $DIR/rc_buffer_arc.rs:20:17
... 13 lines skipped ...
    |                 ^^^^^^^^^^^^^ help: try: `Arc<std::ffi::OsStr>`
 
-error: aborting due to 8 previous errors
-error: aborting due to 8 previous errors
+error: aborting due to 6 previous errors
 


full stderr:
error: usage of `Arc<T>` when T is a buffer type
   |
LL |     bad2: Arc<PathBuf>,
   |           ^^^^^^^^^^^^ help: try: `Arc<std::path::Path>`
   |
   |
   = note: `-D clippy::rc-buffer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::rc_buffer)]`

error: usage of `Arc<T>` when T is a buffer type
   |
   |
LL |     bad3: Arc<Vec<u8>>,
   |           ^^^^^^^^^^^^ help: try: `Arc<[u8]>`

error: usage of `Arc<T>` when T is a buffer type
   |
LL |     bad4: Arc<OsString>,
   |           ^^^^^^^^^^^^^ help: try: `Arc<std::ffi::OsStr>`


error: usage of `Arc<T>` when T is a buffer type
   |
   |
LL | fn func_bad2(_: Arc<PathBuf>) {}
   |                 ^^^^^^^^^^^^ help: try: `Arc<std::path::Path>`

error: usage of `Arc<T>` when T is a buffer type
   |
   |
LL | fn func_bad3(_: Arc<Vec<u8>>) {}
   |                 ^^^^^^^^^^^^ help: try: `Arc<[u8]>`

error: usage of `Arc<T>` when T is a buffer type
   |
   |
LL | fn func_bad4(_: Arc<OsString>) {}
   |                 ^^^^^^^^^^^^^ help: try: `Arc<std::ffi::OsStr>`
error: aborting due to 6 previous errors


full stdout:
full stdout:



FAILED TEST: tests/ui/redundant_type_annotations.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/redundant_type_annotations.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/redundant_type_annotations.stderr` to the actual output
--- tests/ui/redundant_type_annotations.stderr
+++ <stderr output>
+++ <stderr output>
 error: redundant type annotation
   --> $DIR/redundant_type_annotations.rs:81:9
... 18 lines skipped ...
 
 error: redundant type annotation
-  --> $DIR/redundant_type_annotations.rs:159:5
-   |
-LL |     let _return: String = return_a_string();
-
-error: redundant type annotation
   --> $DIR/redundant_type_annotations.rs:162:5
    |
---
 
 error: redundant type annotation
-  --> $DIR/redundant_type_annotations.rs:183:5
-   |
-LL |     let _return: String = Pie::associated_return_a_string();
-
-error: redundant type annotation
   --> $DIR/redundant_type_annotations.rs:190:5
    |
---
+error: aborting due to 14 previous errors
 


error: `redundant type annotation` not found in diagnostics on line 159
    |
    |
160 |     //~^ ERROR: redundant type annotation
    |


error: `redundant type annotation` not found in diagnostics on line 171
    |
    |
172 |     //~^ ERROR: redundant type annotation
    |


error: `redundant type annotation` not found in diagnostics on line 183
    |
    |
184 |     //~^ ERROR: redundant type annotation
    |

full stderr:
error: redundant type annotation
error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:81:9
   |
LL |         let v: u32 = self.return_an_int();
   |
   = note: `-D clippy::redundant-type-annotations` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::redundant_type_annotations)]`


error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:84:9
   |
LL |         let v: &u32 = self.return_a_ref();

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:86:9
   |
   |
LL |         let v: &Slice = self.return_a_ref_to_struct();

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:162:5
   |
   |
LL |     let _return: Pie = return_a_struct();

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:165:5
   |
   |
LL |     let _return: Pizza = return_an_enum();

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:168:5
   |
   |
LL |     let _return: u32 = return_an_int();

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:174:5
   |
   |
LL |     let new_pie: Pie = Pie::new();

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:177:5
   |
   |
LL |     let _return: u32 = new_pie.return_an_int();

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:180:5
   |
   |
LL |     let _return: u32 = Pie::associated_return_an_int();

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:190:5
   |
   |
LL |     let _var: u32 = u32::MAX;

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:193:5
   |
   |
LL |     let _var: u32 = 5_u32;

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:196:5
   |
   |
LL |     let _var: &str = "test";

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:199:5
   |
   |
LL |     let _var: &[u8] = b"test";

error: redundant type annotation
##[error]  --> tests/ui/redundant_type_annotations.rs:202:5
   |
   |
LL |     let _var: bool = false;

error: aborting due to 14 previous errors



full stdout:



FAILED TEST: tests/ui/single_char_add_str.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/single_char_add_str.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/single_char_add_str.stderr` to the actual output
--- tests/ui/single_char_add_str.stderr
+++ <stderr output>
+++ <stderr output>
-error: calling `push_str()` using a single-character string literal
-   |
-   |
-LL |     string.push_str("R");
-   |     ^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('R')`
-   = note: `-D clippy::single-char-add-str` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::single_char_add_str)]`
-
-
-error: calling `push_str()` using a single-character string literal
-   |
-   |
-LL |     string.push_str("'");
-   |     ^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\'')`
-
-error: calling `push_str()` using a single-character string literal
-   |
-   |
-LL |     string.push_str("\x52");
-   |     ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\x52')`
-
-error: calling `push_str()` using a single-character string literal
-   |
-   |
-LL |     string.push_str("\u{0052}");
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\u{0052}')`
-
-error: calling `push_str()` using a single-character string literal
-   |
-   |
-LL |     string.push_str(r##"a"##);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('a')`
-
-error: calling `push_str()` using a single-character string literal
-   |
-   |
-LL |     get_string!().push_str("ö");
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `get_string!().push('ö')`
-
-error: calling `insert_str()` using a single-character string literal
-   |
-   |
-LL |     string.insert_str(0, "R");
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, 'R')`
-
-error: calling `insert_str()` using a single-character string literal
-   |
-   |
-LL |     string.insert_str(1, "'");
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(1, '\'')`
-
-error: calling `insert_str()` using a single-character string literal
-   |
-   |
-LL |     string.insert_str(0, "\x52");
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '\x52')`
-
-error: calling `insert_str()` using a single-character string literal
-   |
-   |
-LL |     string.insert_str(0, "\u{0052}");
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '\u{0052}')`
-
-error: calling `insert_str()` using a single-character string literal
-   |
-   |
-LL |     string.insert_str(x, r##"a"##);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(x, 'a')`
-
-error: calling `insert_str()` using a single-character string literal
-   |
-   |
-LL |     string.insert_str(Y, r##"a"##);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, 'a')`
-
-error: calling `insert_str()` using a single-character string literal
-   |
-   |
-LL |     string.insert_str(Y, r##"""##);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, '"')`
-
-error: calling `insert_str()` using a single-character string literal
-   |
-   |
-LL |     string.insert_str(Y, r##"'"##);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, '\'')`
-
-error: calling `insert_str()` using a single-character string literal
-   |
-   |
-LL |     get_string!().insert_str(1, "?");
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `get_string!().insert(1, '?')`
-error: aborting due to 15 previous errors
-



full stderr:

full stdout:



FAILED TEST: tests/ui/unnecessary_owned_empty_strings.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/unnecessary_owned_empty_strings.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/unnecessary_owned_empty_strings.stderr` to the actual output
--- tests/ui/unnecessary_owned_empty_strings.stderr
+++ <stderr output>
+++ <stderr output>
-error: usage of `&String::new()` for a function expecting a `&str` argument
-   |
-LL |     ref_str_argument(&String::new());
-   |                      ^^^^^^^^^^^^^^ help: try: `""`
-   |
-   |
-   = note: `-D clippy::unnecessary-owned-empty-strings` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::unnecessary_owned_empty_strings)]`
-
 error: usage of `&String::from("")` for a function expecting a `&str` argument
    |
    |
 LL |     ref_str_argument(&String::from(""));
    |                      ^^^^^^^^^^^^^^^^^ help: try: `""`
+   = note: `-D clippy::unnecessary-owned-empty-strings` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::unnecessary_owned_empty_strings)]`
 
-error: aborting due to 2 previous errors
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 


full stderr:
error: usage of `&String::from("")` for a function expecting a `&str` argument
   |
   |
LL |     ref_str_argument(&String::from(""));
   |                      ^^^^^^^^^^^^^^^^^ help: try: `""`
   = note: `-D clippy::unnecessary-owned-empty-strings` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::unnecessary_owned_empty_strings)]`

error: aborting due to 1 previous error
error: aborting due to 1 previous error


full stdout:



FAILED TEST: tests/ui/useless_conversion_try.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/useless_conversion_try.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/useless_conversion_try.stderr` to the actual output
--- tests/ui/useless_conversion_try.stderr
+++ <stderr output>
+++ <stderr output>
 error: useless conversion to the same type: `T`
   --> $DIR/useless_conversion_try.rs:5:13
... 17 lines skipped ...
    = help: consider removing `.try_into()`
-error: useless conversion to the same type: `std::string::String`
+error: useless conversion to the same type: `std::string::string::String`
   --> $DIR/useless_conversion_try.rs:30:21
    |
    |
... 3 lines skipped ...
    = help: consider removing `.try_into()`
-error: useless conversion to the same type: `std::string::String`
+error: useless conversion to the same type: `std::string::string::String`
   --> $DIR/useless_conversion_try.rs:32:21
    |
---
+error: useless conversion to the same type: `std::string::string::String`
   --> $DIR/useless_conversion_try.rs:38:21
    |
... 3 lines skipped ...
    = help: consider removing `.try_into()`
-error: useless conversion to the same type: `std::string::String`
+error: useless conversion to the same type: `std::string::string::String`
   --> $DIR/useless_conversion_try.rs:40:21
    |
    |
... 3 lines skipped ...
    = help: consider removing `.try_into()`
-error: useless conversion to the same type: `std::string::String`
+error: useless conversion to the same type: `std::string::string::String`
   --> $DIR/useless_conversion_try.rs:42:27
    |
    |
... 3 lines skipped ...
    = help: consider removing `.try_into()`
-error: aborting due to 9 previous errors
+error: aborting due to 7 previous errors
 



error: `useless conversion to the same type: `std::string::String`` not found in diagnostics on line 30
   |
   |
31 |     //~^ ERROR: useless conversion to the same type: `std::string::String`
   |


error: `useless conversion to the same type: `std::string::String`` not found in diagnostics on line 32
   |
   |
33 |     //~^ ERROR: useless conversion to the same type: `std::string::String`
   |


error: `useless conversion to the same type: `std::string::String`` not found in diagnostics on line 34
   |
   |
35 |     //~^ ERROR: useless conversion to the same type: `std::string::String`
   |


error: `useless conversion to the same type: `std::string::String`` not found in diagnostics on line 36
   |
   |
37 |     //~^ ERROR: useless conversion to the same type: `std::string::String`
   |


error: `useless conversion to the same type: `std::string::String`` not found in diagnostics on line 38
   |
   |
39 |     //~^ ERROR: useless conversion to the same type: `std::string::String`
   |


error: `useless conversion to the same type: `std::string::String`` not found in diagnostics on line 40
   |
   |
41 |     //~^ ERROR: useless conversion to the same type: `std::string::String`
   |


error: `useless conversion to the same type: `std::string::String`` not found in diagnostics on line 42
   |
   |
43 |         //~^ ERROR: useless conversion to the same type: `std::string::String`
   |

full stderr:
error: useless conversion to the same type: `T`
error: useless conversion to the same type: `T`
##[error]  --> tests/ui/useless_conversion_try.rs:5:13
   |
LL |     let _ = T::try_from(val).unwrap();
   |
   |
   = help: consider removing `T::try_from()`
  --> tests/ui/useless_conversion_try.rs:1:9
   |
LL | #![deny(clippy::useless_conversion)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: useless conversion to the same type: `T`
##[error]  --> tests/ui/useless_conversion_try.rs:7:5
   |
LL |     val.try_into().unwrap()
   |     ^^^^^^^^^^^^^^
   |
   = help: consider removing `.try_into()`
error: useless conversion to the same type: `std::string::string::String`
##[error]  --> tests/ui/useless_conversion_try.rs:30:21
   |
   |
LL |     let _: String = "foo".to_string().try_into().unwrap();
   |
   |
   = help: consider removing `.try_into()`
error: useless conversion to the same type: `std::string::string::String`
##[error]  --> tests/ui/useless_conversion_try.rs:32:21
   |
   |
LL |     let _: String = TryFrom::try_from("foo".to_string()).unwrap();
   |
   = help: consider removing `TryFrom::try_from()`

error: useless conversion to the same type: `std::string::string::String`
error: useless conversion to the same type: `std::string::string::String`
##[error]  --> tests/ui/useless_conversion_try.rs:38:21
   |
LL |     let _: String = format!("Hello {}", "world").try_into().unwrap();
   |
   |
   = help: consider removing `.try_into()`
error: useless conversion to the same type: `std::string::string::String`
##[error]  --> tests/ui/useless_conversion_try.rs:40:21
   |
   |
LL |     let _: String = String::new().try_into().unwrap();
   |
   |
   = help: consider removing `.try_into()`
error: useless conversion to the same type: `std::string::string::String`
##[error]  --> tests/ui/useless_conversion_try.rs:42:27
   |
   |
LL |     let _: String = match String::from("_").try_into() {
   |
   |
   = help: consider removing `.try_into()`
error: aborting due to 7 previous errors


full stdout:
full stdout:



FAILED TEST: tests/ui/useless_conversion.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui" "tests/ui/useless_conversion.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/useless_conversion.stderr` to the actual output
--- tests/ui/useless_conversion.stderr
+++ <stderr output>
+++ <stderr output>
 error: useless conversion to the same type: `T`
   --> $DIR/useless_conversion.rs:5:13
... 50 lines skipped ...
    |                 ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
-error: useless conversion to the same type: `std::string::String`
+error: useless conversion to the same type: `std::string::string::String`
   --> $DIR/useless_conversion.rs:132:21
    |
    |
 LL |     let _: String = "foo".to_string().into();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
-error: useless conversion to the same type: `std::string::String`
+error: useless conversion to the same type: `std::string::string::String`
   --> $DIR/useless_conversion.rs:133:21
    |
    |
 LL |     let _: String = From::from("foo".to_string());
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
-error: useless conversion to the same type: `std::string::String`
-  --> $DIR/useless_conversion.rs:134:13
-   |
-   |
-LL |     let _ = String::from("foo".to_string());
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
-error: useless conversion to the same type: `std::string::String`
-  --> $DIR/useless_conversion.rs:135:13
-   |
-   |
-LL |     let _ = String::from(format!("A: {:04}", 123));
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)`
 error: useless conversion to the same type: `std::str::Lines<'_>`
   --> $DIR/useless_conversion.rs:136:13
... 8 lines skipped ...
... 8 lines skipped ...
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()`
-error: useless conversion to the same type: `std::string::String`
+error: useless conversion to the same type: `std::string::string::String`
   --> $DIR/useless_conversion.rs:138:21
    |
---
full stderr:
error: useless conversion to the same type: `T`
##[error]  --> tests/ui/useless_conversion.rs:5:13
   |
LL |     let _ = T::from(val);
   |             ^^^^^^^^^^^^ help: consider removing `T::from()`: `val`
note: the lint level is defined here
  --> tests/ui/useless_conversion.rs:1:9
   |
LL | #![deny(clippy::useless_conversion)]
LL | #![deny(clippy::useless_conversion)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: useless conversion to the same type: `T`
##[error]  --> tests/ui/useless_conversion.rs:6:5
   |
LL |     val.into()
   |     ^^^^^^^^^^ help: consider removing `.into()`: `val`
error: useless conversion to the same type: `i32`
##[error]  --> tests/ui/useless_conversion.rs:18:22
   |
   |
LL |         let _: i32 = 0i32.into();
   |                      ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error]  --> tests/ui/useless_conversion.rs:48:22
   |
   |
LL |     if Some("ok") == lines.into_iter().next() {}
   |                      ^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `lines`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error]  --> tests/ui/useless_conversion.rs:53:21
   |
LL |     let mut lines = text.lines().into_iter();
LL |     let mut lines = text.lines().into_iter();
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error]  --> tests/ui/useless_conversion.rs:59:22
   |
   |
LL |     if Some("ok") == text.lines().into_iter().next() {}
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
error: useless conversion to the same type: `std::ops::Range<i32>`
##[error]  --> tests/ui/useless_conversion.rs:65:13
   |
LL |     let _ = NUMBERS.into_iter().next();
LL |     let _ = NUMBERS.into_iter().next();
   |             ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
error: useless conversion to the same type: `std::ops::Range<i32>`
##[error]  --> tests/ui/useless_conversion.rs:70:17
   |
LL |     let mut n = NUMBERS.into_iter();
LL |     let mut n = NUMBERS.into_iter();
   |                 ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
error: useless conversion to the same type: `std::string::string::String`
##[error]  --> tests/ui/useless_conversion.rs:132:21
   |
   |
LL |     let _: String = "foo".to_string().into();
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
error: useless conversion to the same type: `std::string::string::String`
##[error]  --> tests/ui/useless_conversion.rs:133:21
   |
   |
LL |     let _: String = From::from("foo".to_string());
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
error: useless conversion to the same type: `std::str::Lines<'_>`
##[error]  --> tests/ui/useless_conversion.rs:136:13
   |
   |
LL |     let _ = "".lines().into_iter();
   |             ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
error: useless conversion to the same type: `std::vec::IntoIter<i32>`
##[error]  --> tests/ui/useless_conversion.rs:137:13
   |
   |
LL |     let _ = vec![1, 2, 3].into_iter().into_iter();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()`
error: useless conversion to the same type: `std::string::string::String`
##[error]  --> tests/ui/useless_conversion.rs:138:21
   |
   |
LL |     let _: String = format!("Hello {}", "world").into();
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")`
error: useless conversion to the same type: `i32`
##[error]  --> tests/ui/useless_conversion.rs:143:13
   |
   |
LL |     let _ = i32::from(a + b) * 3;
   |             ^^^^^^^^^^^^^^^^ help: consider removing `i32::from()`: `(a + b)`

error: useless conversion to the same type: `Foo<'a'>`
   |
   |
LL |     let _: Foo<'a'> = s2.into();
   |                       ^^^^^^^^^ help: consider removing `.into()`: `s2`

error: useless conversion to the same type: `Foo<'a'>`
   |
   |
LL |     let _ = Foo::<'a'>::from(s3);
   |             ^^^^^^^^^^^^^^^^^^^^ help: consider removing `Foo::<'a'>::from()`: `s3`

error: useless conversion to the same type: `std::vec::IntoIter<Foo<'a'>>`
   |
   |
LL |     let _ = vec![s4, s4, s4].into_iter().into_iter();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![s4, s4, s4].into_iter()`

error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   |
   |
LL |     b(vec![1, 2].into_iter());
   |       ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   |
   |
LL |     fn b<T: IntoIterator<Item = i32>>(_: T) {}


error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   |
   |
LL |     c(vec![1, 2].into_iter());
   |       ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   |
   |
LL |     fn c(_: impl IntoIterator<Item = i32>) {}


error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   |
   |
LL |     d(vec![1, 2].into_iter());
   |       ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   |
   |
LL |         T: IntoIterator<Item = i32>,


error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   |
   |
LL |     b(vec![1, 2].into_iter().into_iter());
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   |
   |
LL |     fn b<T: IntoIterator<Item = i32>>(_: T) {}


error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   |
   |
LL |     b(vec![1, 2].into_iter().into_iter().into_iter());
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   |
   |
LL |     fn b<T: IntoIterator<Item = i32>>(_: T) {}


error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   |
   |
LL |         foo2::<i32, _>([1, 2, 3].into_iter());
   |                        ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   |
   |
LL |         I: IntoIterator<Item = i32> + Helper<X>,


error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   |
   |
LL |         foo3([1, 2, 3].into_iter());
   |              ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   |
LL |         I: IntoIterator<Item = i32>,
   |            ^^^^^^^^^^^^^^^^^^^^^^^^


error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   |
   |
LL |         S1.foo([1, 2].into_iter());
   |                ^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2]`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   |
   |
LL |             pub fn foo<I: IntoIterator>(&self, _: I) {}


error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   |
   |
LL |         v0.into_iter().interleave_shortest(v1.into_iter());
   |                                            ^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `v1`
   |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   |
LL |                 J: IntoIterator,
   |                    ^^^^^^^^^^^^

---



FAILED TEST: tests/ui/crashes/ice-3969.rs
command: CLIPPY_CONF_DIR="tests" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-88cd92e38577594d.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5233f2f9ab0a885d.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c555dfce7b7b4482.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-9cfde403f4813861.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-7f737c8175775d48.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-5a42172620baa7f7.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-067e61b28e8c0ae8.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-56de3874fe91412c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-67f57c9d74692487.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-1ddd9d5371e89c55.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0080dad30daeaebf.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-95373de42170edbf.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui/crashes" "tests/ui/crashes/ice-3969.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/crashes/ice-3969.stderr` to the actual output
--- tests/ui/crashes/ice-3969.stderr
+++ <stderr output>
+++ <stderr output>
 error: trait bound str: std::marker::Sized does not depend on any type or lifetime parameters
   --> $DIR/ice-3969.rs:20:10
... 17 lines skipped ...
    |          ^^^^^
 
-error: trait bound std::string::String: std::ops::Neg does not depend on any type or lifetime parameters
+error: trait bound std::string::string::String: std::ops::Neg does not depend on any type or lifetime parameters
   --> $DIR/ice-3969.rs:42:13
... 9 lines skipped ...
 error: aborting due to 5 previous errors
 



error: `trait bound std::string::String: std::ops::Neg does not depend on any type` not found in diagnostics on line 42
   |
   |
43 |     //~^ ERROR: trait bound std::string::String: std::ops::Neg does not depend on any type
   |

full stderr:
error: trait bound str: std::marker::Sized does not depend on any type or lifetime parameters
---
   |
   = note: `-D trivial-bounds` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(trivial_bounds)]`

error: trait bound for<'a> Dst<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters
   |
   |
LL |     for<'a> Dst<dyn A + 'a>: Sized,

error: trait bound str: std::marker::Sized does not depend on any type or lifetime parameters
##[error]  --> tests/ui/crashes/ice-3969.rs:34:10
   |
   |
LL |     str: Sized,
   |          ^^^^^

error: trait bound std::string::string::String: std::ops::Neg does not depend on any type or lifetime parameters
   |
   |
LL |     String: ::std::ops::Neg<Output = String>,


error: trait bound i32: std::iter::Iterator does not depend on any type or lifetime parameters
   |
LL |     i32: Iterator,
   |          ^^^^^^^^

---
test result: FAIL. 17 failed; 927 passed; 1 ignored;



command did not execute successfully: cd "/checkout" && env -u MAKEFLAGS -u MFLAGS AR_x86_64_unknown_linux_gnu="ar" CARGO_INCREMENTAL="0" CARGO_PROFILE_RELEASE_DEBUG="0" CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS="true" CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS="true" CARGO_PROFILE_RELEASE_STRIP="false" CARGO_TARGET_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools" CC_x86_64_unknown_linux_gnu="sccache cc" CFG_COMPILER_BUILD_TRIPLE="x86_64-unknown-linux-gnu" CFG_COMPILER_HOST_TRIPLE="x86_64-unknown-linux-gnu" CFG_RELEASE="1.77.0-nightly" CFG_RELEASE_CHANNEL="nightly" CFG_RELEASE_NUM="1.77.0" CFG_VERSION="1.77.0-nightly (0ba061eb7 2024-01-18)" CFG_VER_DATE="2024-01-18" CFG_VER_HASH="0ba061eb7a70db7d0b61b28b1f2a28425e6fc605" CFLAGS_x86_64_unknown_linux_gnu="-ffunction-sections -fdata-sections -fPIC -m64" CXXFLAGS_x86_64_unknown_linux_gnu="-ffunction-sections -fdata-sections -fPIC -m64" CXX_x86_64_unknown_linux_gnu="sccache c++" DOC_RUST_LANG_ORG_CHANNEL="https://doc.rust-lang.org/nightly" HOST_LIBS="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release" LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" LIBC_CHECK_CFG="1" LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm/lib" LIBZ_SYS_STATIC="1" LZMA_API_STATIC="1" RANLIB_x86_64_unknown_linux_gnu="ar s" REAL_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" RUSTBUILD_NATIVE_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/native" RUSTC="/checkout/obj/build/bootstrap/debug/rustc" RUSTC_BOOTSTRAP="1" RUSTC_BREAK_ON_ICE="1" RUSTC_ERROR_METADATA_DST="/checkout/obj/build/tmp/extended-error-metadata" RUSTC_HOST_FLAGS="-Zunstable-options --check-cfg=cfg(bootstrap)" RUSTC_INSTALL_BINDIR="bin" RUSTC_LIBDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" RUSTC_LIB_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" RUSTC_LINT_FLAGS="-Wrust_2018_idioms -Wunused_lifetimes -Dwarnings" RUSTC_REAL="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" RUSTC_SNAPSHOT="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" RUSTC_SNAPSHOT_LIBDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" RUSTC_STAGE="2" RUSTC_SYSROOT="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" RUSTC_TEST_SUITE="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" RUSTC_TLS_MODEL_INITIAL_EXEC="1" RUSTC_VERBOSE="0" RUSTC_WRAPPER="/checkout/obj/build/bootstrap/debug/rustc" RUSTDOC="/checkout/obj/build/bootstrap/debug/rustdoc" RUSTDOCFLAGS="--cfg=windows_raw_dylib -Csymbol-mangling-version=v0 -Zunstable-options --check-cfg=cfg(bootstrap) --check-cfg=cfg(parallel_compiler) --check-cfg=cfg(rust_analyzer) --check-cfg=cfg(no_btreemap_remove_entry) --check-cfg=cfg(crossbeam_loom) --check-cfg=cfg(span_locations) --check-cfg=cfg(rustix_use_libc) --check-cfg=cfg(emulate_second_only_system) --check-cfg=cfg(windows_raw_dylib) -Dwarnings -Wrustdoc::invalid_codeblock_attributes --crate-version 1.77.0-nightly\t(0ba061eb7\t2024-01-18)" RUSTDOC_LIBDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" RUSTDOC_REAL="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" RUSTFLAGS="--cfg=windows_raw_dylib -Csymbol-mangling-version=v0 -Zunstable-options --check-cfg=cfg(bootstrap) --check-cfg=cfg(parallel_compiler) --check-cfg=cfg(rust_analyzer) --check-cfg=cfg(no_btreemap_remove_entry) --check-cfg=cfg(crossbeam_loom) --check-cfg=cfg(span_locations) --check-cfg=cfg(rustix_use_libc) --check-cfg=cfg(emulate_second_only_system) --check-cfg=cfg(windows_raw_dylib) -Zmacro-backtrace -Clink-args=-Wl,-z,origin -Clink-args=-Wl,-rpath,$ORIGIN/../lib -Csplit-debuginfo=off -Zunstable-options" RUST_TEST_THREADS="16" SYSROOT="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" TERM="xterm" __CARGO_DEFAULT_LIB_METADATA="nightlytool-rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "--release" "-Zcheck-cfg" "-Zbinary-dep-depinfo" "-j" "16" "--locked" "--color" "always" "--manifest-path" "/checkout/src/tools/clippy/Cargo.toml" "--" "--quiet"

stdout ----

stderr ----

@yanchith yanchith mentioned this pull request Mar 23, 2024
18 tasks
@zachs18 zachs18 marked this pull request as draft May 3, 2024 01:14
@zachs18
Copy link
Contributor Author

zachs18 commented May 3, 2024

Still more work to do to to get clippy/tests/etc working with having String be a type alias, that I don't have time to do at the moment, so marking this as a draft for now. If someone else would like to take this as a starting point in the meantime, feel free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants