Unnamed repository; edit this file 'description' to name the repository.
useless_conversion
Johann Hemmann 2024-02-01
parent e7d0dea · commit b73ee2f
-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 9fb04589e2..640f478b0c 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 a76ddffb41..a27ffe2167 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 73fbad5e67..7ce05b64d0 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 2c7e222791..70da0ef8e1 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 6a62ef6970..23d41cc0d8 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 8978be8133..5c369f42e6 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 eeb28b8fe4..54d96ab138 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 {