useless_conversion

This commit is contained in:
Johann Hemmann 2024-01-22 01:31:50 +01:00
parent e7d0deac53
commit b73ee2f50d
7 changed files with 10 additions and 14 deletions

View File

@ -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"

View File

@ -256,7 +256,7 @@ pub(crate) fn new(message: impl Into<core::fmt::Arguments>) -> 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) {

View File

@ -782,7 +782,7 @@ fn collect_macro_items(
self.diagnostics.push(DefDiagnostic::macro_expansion_parse_error(
self.module_id.local_id,
error_call_kind(),
errors.into(),
errors,
));
}

View File

@ -475,7 +475,7 @@ fn resolve_name_in_module(
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),

View File

@ -131,13 +131,11 @@ pub fn iter_items(self) -> impl Iterator<Item = (ItemInNs, Option<ImportOrExtern
.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))),
)
}
}

View File

@ -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;

View File

@ -1744,7 +1744,7 @@ pub fn prime_caches_num_threads(&self) -> u8 {
}
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 {