about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohann Hemmann <johann.hemmann@code.berlin>2024-01-22 01:31:50 +0100
committerJohann Hemmann <johann.hemmann@code.berlin>2024-01-31 19:06:18 +0100
commitb73ee2f50df1488be42a0fb9b2f7d915a7cae49d (patch)
treef15e9f41c656d45c81972c208953f52233084fe2
parente7d0deac538af1d7372608bb02f6caa8bf834de2 (diff)
downloadrust-b73ee2f50df1488be42a0fb9b2f7d915a7cae49d.tar.gz
rust-b73ee2f50df1488be42a0fb9b2f7d915a7cae49d.zip
useless_conversion
-rw-r--r--Cargo.toml1
-rw-r--r--crates/hir-def/src/body/tests.rs4
-rw-r--r--crates/hir-def/src/data.rs2
-rw-r--r--crates/hir-def/src/nameres/path_resolution.rs2
-rw-r--r--crates/hir-def/src/per_ns.rs6
-rw-r--r--crates/hir/src/attrs.rs7
-rw-r--r--crates/rust-analyzer/src/config.rs2
7 files changed, 10 insertions, 14 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 9fb04589e2c..640f478b0c1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -181,7 +181,6 @@ non_canonical_partial_ord_impl = "allow"
 self_named_constructors = "allow"
 too_many_arguments = "allow"
 type_complexity = "allow"
-useless_conversion = "allow"
 useless_format = "allow"
 wildcard_in_or_patterns = "allow"
 wrong_self_convention = "allow"
diff --git a/crates/hir-def/src/body/tests.rs b/crates/hir-def/src/body/tests.rs
index a76ddffb411..a27ffe21675 100644
--- a/crates/hir-def/src/body/tests.rs
+++ b/crates/hir-def/src/body/tests.rs
@@ -256,7 +256,7 @@ impl SsrError {
 "##,
     );
 
-    assert_eq!(db.body_with_source_map(def.into()).1.diagnostics(), &[]);
+    assert_eq!(db.body_with_source_map(def).1.diagnostics(), &[]);
     expect![[r#"
         fn main() {
             _ = $crate::error::SsrError::new(
@@ -309,7 +309,7 @@ fn f() {
 "#,
     );
 
-    let (_, source_map) = db.body_with_source_map(def.into());
+    let (_, source_map) = db.body_with_source_map(def);
     assert_eq!(source_map.diagnostics(), &[]);
 
     for (_, def_map) in body.blocks(&db) {
diff --git a/crates/hir-def/src/data.rs b/crates/hir-def/src/data.rs
index 73fbad5e675..7ce05b64d02 100644
--- a/crates/hir-def/src/data.rs
+++ b/crates/hir-def/src/data.rs
@@ -782,7 +782,7 @@ impl<'a> AssocItemCollector<'a> {
             self.diagnostics.push(DefDiagnostic::macro_expansion_parse_error(
                 self.module_id.local_id,
                 error_call_kind(),
-                errors.into(),
+                errors,
             ));
         }
 
diff --git a/crates/hir-def/src/nameres/path_resolution.rs b/crates/hir-def/src/nameres/path_resolution.rs
index 2c7e2227913..70da0ef8e1e 100644
--- a/crates/hir-def/src/nameres/path_resolution.rs
+++ b/crates/hir-def/src/nameres/path_resolution.rs
@@ -475,7 +475,7 @@ impl DefMap {
         let macro_use_prelude = || {
             self.macro_use_prelude.get(name).map_or(PerNs::none(), |&(it, _extern_crate)| {
                 PerNs::macros(
-                    it.into(),
+                    it,
                     Visibility::Public,
                     // FIXME?
                     None, // extern_crate.map(ImportOrExternCrate::ExternCrate),
diff --git a/crates/hir-def/src/per_ns.rs b/crates/hir-def/src/per_ns.rs
index 6a62ef69701..23d41cc0d88 100644
--- a/crates/hir-def/src/per_ns.rs
+++ b/crates/hir-def/src/per_ns.rs
@@ -131,13 +131,11 @@ impl PerNs {
             .into_iter()
             .chain(
                 self.values
-                    .map(|it| (ItemInNs::Values(it.0), it.2.map(ImportOrExternCrate::Import)))
-                    .into_iter(),
+                    .map(|it| (ItemInNs::Values(it.0), it.2.map(ImportOrExternCrate::Import))),
             )
             .chain(
                 self.macros
-                    .map(|it| (ItemInNs::Macros(it.0), it.2.map(ImportOrExternCrate::Import)))
-                    .into_iter(),
+                    .map(|it| (ItemInNs::Macros(it.0), it.2.map(ImportOrExternCrate::Import))),
             )
     }
 }
diff --git a/crates/hir/src/attrs.rs b/crates/hir/src/attrs.rs
index 8978be81332..5c369f42e6e 100644
--- a/crates/hir/src/attrs.rs
+++ b/crates/hir/src/attrs.rs
@@ -239,10 +239,9 @@ fn resolve_impl_trait_item(
 ) -> Option<DocLinkDef> {
     let canonical = ty.canonical();
     let krate = ty.krate(db);
-    let environment = resolver.generic_def().map_or_else(
-        || crate::TraitEnvironment::empty(krate.id).into(),
-        |d| db.trait_environment(d),
-    );
+    let environment = resolver
+        .generic_def()
+        .map_or_else(|| crate::TraitEnvironment::empty(krate.id), |d| db.trait_environment(d));
     let traits_in_scope = resolver.traits_in_scope(db.upcast());
 
     let mut result = None;
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index eeb28b8fe42..54d96ab1381 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -1744,7 +1744,7 @@ impl Config {
     }
 
     pub fn main_loop_num_threads(&self) -> usize {
-        self.data.numThreads.unwrap_or(num_cpus::get_physical().try_into().unwrap_or(1))
+        self.data.numThreads.unwrap_or(num_cpus::get_physical())
     }
 
     pub fn typing_autoclose_angle(&self) -> bool {