about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--crates/hir-ty/src/infer/pat.rs2
-rw-r--r--crates/ide/src/hover/render.rs4
-rw-r--r--crates/ide/src/syntax_highlighting/tags.rs4
-rw-r--r--crates/intern/src/lib.rs1
-rw-r--r--crates/project-model/src/build_scripts.rs2
-rw-r--r--crates/rust-analyzer/src/cli/progress_report.rs2
-rw-r--r--crates/rust-analyzer/src/handlers/notification.rs2
-rw-r--r--crates/rust-analyzer/src/main_loop.rs2
-rw-r--r--crates/rust-analyzer/src/reload.rs4
-rw-r--r--crates/rust-analyzer/tests/slow-tests/tidy.rs2
-rw-r--r--crates/salsa/salsa-macros/src/database_storage.rs3
-rw-r--r--crates/salsa/salsa-macros/src/parenthesized.rs2
-rw-r--r--crates/salsa/salsa-macros/src/query_group.rs2
-rw-r--r--crates/salsa/src/derived.rs1
-rw-r--r--crates/salsa/src/derived/slot.rs1
-rw-r--r--crates/salsa/src/durability.rs1
-rw-r--r--crates/salsa/src/hash.rs1
-rw-r--r--crates/salsa/src/input.rs1
-rw-r--r--crates/salsa/src/intern_id.rs1
-rw-r--r--crates/salsa/src/interned.rs1
-rw-r--r--crates/salsa/src/lib.rs15
-rw-r--r--crates/salsa/src/lru.rs1
-rw-r--r--crates/salsa/src/plumbing.rs1
-rw-r--r--crates/salsa/src/revision.rs1
-rw-r--r--crates/salsa/src/runtime.rs3
-rw-r--r--crates/salsa/src/runtime/dependency_graph.rs1
-rw-r--r--crates/salsa/src/runtime/local_state.rs1
-rw-r--r--crates/salsa/src/storage.rs1
-rw-r--r--crates/sourcegen/src/lib.rs2
-rw-r--r--crates/test-utils/src/fixture.rs2
-rw-r--r--xtask/src/codegen.rs2
-rw-r--r--xtask/src/codegen/lints.rs2
33 files changed, 31 insertions, 42 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d9343d2b963..99338d9d970 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -188,6 +188,8 @@ enum_variant_names = "allow"
 new_ret_no_self = "allow"
 # Has a bunch of false positives
 useless_asref = "allow"
+# Has false positives
+assigning_clones = "allow"
 
 ## Following lints should be tackled at some point
 too_many_arguments = "allow"
diff --git a/crates/hir-ty/src/infer/pat.rs b/crates/hir-ty/src/infer/pat.rs
index 09a4d998ee1..30005a25512 100644
--- a/crates/hir-ty/src/infer/pat.rs
+++ b/crates/hir-ty/src/infer/pat.rs
@@ -149,7 +149,7 @@ impl InferenceContext<'_> {
         expected: &Ty,
         default_bm: T::BindingMode,
         id: T,
-        subs: impl Iterator<Item = (Name, T)> + ExactSizeIterator,
+        subs: impl ExactSizeIterator<Item = (Name, T)>,
     ) -> Ty {
         let (ty, def) = self.resolve_variant(path, false);
         if let Some(variant) = def {
diff --git a/crates/ide/src/hover/render.rs b/crates/ide/src/hover/render.rs
index 63777d49105..ae630d7ab0e 100644
--- a/crates/ide/src/hover/render.rs
+++ b/crates/ide/src/hover/render.rs
@@ -101,7 +101,7 @@ pub(super) fn try_expr(
                 if let Some((inner, body)) = error_type_args {
                     inner_ty = inner;
                     body_ty = body;
-                    s = "Try Error".to_owned();
+                    "Try Error".clone_into(&mut s);
                 }
             }
         }
@@ -634,7 +634,7 @@ fn closure_ty(
         })
         .join("\n");
     if captures_rendered.trim().is_empty() {
-        captures_rendered = "This closure captures nothing".to_owned();
+        "This closure captures nothing".clone_into(&mut captures_rendered);
     }
     let mut targets: Vec<hir::ModuleDef> = Vec::new();
     let mut push_new_def = |item: hir::ModuleDef| {
diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs
index 5c7a463ccdc..d9225fedeae 100644
--- a/crates/ide/src/syntax_highlighting/tags.rs
+++ b/crates/ide/src/syntax_highlighting/tags.rs
@@ -113,7 +113,7 @@ pub enum HlPunct {
     Semi,
     /// ! (only for macro calls)
     MacroBang,
-    ///
+    /// Other punctutations
     Other,
 }
 
@@ -127,7 +127,7 @@ pub enum HlOperator {
     Logical,
     /// >, <, ==, >=, <=, !=
     Comparison,
-    ///
+    /// Other operators
     Other,
 }
 
diff --git a/crates/intern/src/lib.rs b/crates/intern/src/lib.rs
index d784321c7c7..40d18b1cf86 100644
--- a/crates/intern/src/lib.rs
+++ b/crates/intern/src/lib.rs
@@ -174,6 +174,7 @@ pub struct InternStorage<T: ?Sized> {
     map: OnceLock<InternMap<T>>,
 }
 
+#[allow(clippy::new_without_default)] // this a const fn, so it can't be default
 impl<T: ?Sized> InternStorage<T> {
     pub const fn new() -> Self {
         Self { map: OnceLock::new() }
diff --git a/crates/project-model/src/build_scripts.rs b/crates/project-model/src/build_scripts.rs
index d40eb26063d..f813c09e0a2 100644
--- a/crates/project-model/src/build_scripts.rs
+++ b/crates/project-model/src/build_scripts.rs
@@ -235,7 +235,7 @@ impl WorkspaceBuildScripts {
             },
             progress,
         )?;
-        res.iter_mut().for_each(|it| it.error = errors.clone());
+        res.iter_mut().for_each(|it| it.error.clone_from(&errors));
         collisions.into_iter().for_each(|(id, workspace, package)| {
             if let Some(&(p, w)) = by_id.get(id) {
                 res[workspace].outputs[package] = res[w].outputs[p].clone();
diff --git a/crates/rust-analyzer/src/cli/progress_report.rs b/crates/rust-analyzer/src/cli/progress_report.rs
index b2337300997..6964977840a 100644
--- a/crates/rust-analyzer/src/cli/progress_report.rs
+++ b/crates/rust-analyzer/src/cli/progress_report.rs
@@ -92,7 +92,7 @@ impl<'a> ProgressReport<'a> {
 
         let _ = io::stdout().write(output.as_bytes());
         let _ = io::stdout().flush();
-        self.text = text.to_owned();
+        text.clone_into(&mut self.text);
     }
 
     fn set_value(&mut self, value: f32) {
diff --git a/crates/rust-analyzer/src/handlers/notification.rs b/crates/rust-analyzer/src/handlers/notification.rs
index b5c4a4f435e..de546c7c964 100644
--- a/crates/rust-analyzer/src/handlers/notification.rs
+++ b/crates/rust-analyzer/src/handlers/notification.rs
@@ -105,7 +105,7 @@ pub(crate) fn handle_did_change_text_document(
         )
         .into_bytes();
         if *data != new_contents {
-            *data = new_contents.clone();
+            data.clone_from(&new_contents);
             state.vfs.write().0.set_file_contents(path, Some(new_contents));
         }
     }
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 666bf2920e4..2e39c99a39d 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -412,7 +412,7 @@ impl GlobalState {
                 // See https://github.com/rust-lang/rust-analyzer/issues/13130
                 let patch_empty = |message: &mut String| {
                     if message.is_empty() {
-                        *message = " ".to_owned();
+                        " ".clone_into(message);
                     }
                 };
 
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 499e779978b..d0462d5733e 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -725,13 +725,13 @@ pub fn ws_to_crate_graph(
                 if layouts.len() <= idx {
                     layouts.resize(idx + 1, e.clone());
                 }
-                layouts[idx] = layout.clone();
+                layouts[idx].clone_from(&layout);
             }
             if idx >= num_toolchains {
                 if toolchains.len() <= idx {
                     toolchains.resize(idx + 1, None);
                 }
-                toolchains[idx] = toolchain.clone();
+                toolchains[idx].clone_from(&toolchain);
             }
         });
         proc_macro_paths.push(crate_proc_macros);
diff --git a/crates/rust-analyzer/tests/slow-tests/tidy.rs b/crates/rust-analyzer/tests/slow-tests/tidy.rs
index 78da4487d4c..34439391333 100644
--- a/crates/rust-analyzer/tests/slow-tests/tidy.rs
+++ b/crates/rust-analyzer/tests/slow-tests/tidy.rs
@@ -243,7 +243,7 @@ struct TidyDocs {
 impl TidyDocs {
     fn visit(&mut self, path: &Path, text: &str) {
         // Tests and diagnostic fixes don't need module level comments.
-        if is_exclude_dir(path, &["tests", "test_data", "fixes", "grammar"]) {
+        if is_exclude_dir(path, &["tests", "test_data", "fixes", "grammar", "salsa"]) {
             return;
         }
 
diff --git a/crates/salsa/salsa-macros/src/database_storage.rs b/crates/salsa/salsa-macros/src/database_storage.rs
index 223da9b5290..14238e2fed5 100644
--- a/crates/salsa/salsa-macros/src/database_storage.rs
+++ b/crates/salsa/salsa-macros/src/database_storage.rs
@@ -1,4 +1,5 @@
-//!
+//! Implementation for `[salsa::database]` decorator.
+
 use heck::ToSnakeCase;
 use proc_macro::TokenStream;
 use syn::parse::{Parse, ParseStream};
diff --git a/crates/salsa/salsa-macros/src/parenthesized.rs b/crates/salsa/salsa-macros/src/parenthesized.rs
index 9df41e03c16..5ecd1b8a058 100644
--- a/crates/salsa/salsa-macros/src/parenthesized.rs
+++ b/crates/salsa/salsa-macros/src/parenthesized.rs
@@ -1,4 +1,4 @@
-//!
+//! Parenthesis helper
 pub(crate) struct Parenthesized<T>(pub(crate) T);
 
 impl<T> syn::parse::Parse for Parenthesized<T>
diff --git a/crates/salsa/salsa-macros/src/query_group.rs b/crates/salsa/salsa-macros/src/query_group.rs
index 5983765eec7..659797d6d4a 100644
--- a/crates/salsa/salsa-macros/src/query_group.rs
+++ b/crates/salsa/salsa-macros/src/query_group.rs
@@ -1,4 +1,4 @@
-//!
+//! Implementation for `[salsa::query_group]` decorator.
 
 use crate::parenthesized::Parenthesized;
 use heck::ToUpperCamelCase;
diff --git a/crates/salsa/src/derived.rs b/crates/salsa/src/derived.rs
index 3b5bd7f9e3b..fd31ab20416 100644
--- a/crates/salsa/src/derived.rs
+++ b/crates/salsa/src/derived.rs
@@ -1,4 +1,3 @@
-//!
 use crate::debug::TableEntry;
 use crate::durability::Durability;
 use crate::hash::FxIndexMap;
diff --git a/crates/salsa/src/derived/slot.rs b/crates/salsa/src/derived/slot.rs
index 75204c8ff60..cfafa40ce33 100644
--- a/crates/salsa/src/derived/slot.rs
+++ b/crates/salsa/src/derived/slot.rs
@@ -1,4 +1,3 @@
-//!
 use crate::debug::TableEntry;
 use crate::derived::MemoizationPolicy;
 use crate::durability::Durability;
diff --git a/crates/salsa/src/durability.rs b/crates/salsa/src/durability.rs
index 44abae3170f..7b8e6840fc9 100644
--- a/crates/salsa/src/durability.rs
+++ b/crates/salsa/src/durability.rs
@@ -1,4 +1,3 @@
-//!
 /// Describes how likely a value is to change -- how "durable" it is.
 /// By default, inputs have `Durability::LOW` and interned values have
 /// `Durability::HIGH`. But inputs can be explicitly set with other
diff --git a/crates/salsa/src/hash.rs b/crates/salsa/src/hash.rs
index 47a2dd1ce0c..3b2d7df3fbe 100644
--- a/crates/salsa/src/hash.rs
+++ b/crates/salsa/src/hash.rs
@@ -1,4 +1,3 @@
-//!
 pub(crate) type FxHasher = std::hash::BuildHasherDefault<rustc_hash::FxHasher>;
 pub(crate) type FxIndexSet<K> = indexmap::IndexSet<K, FxHasher>;
 pub(crate) type FxIndexMap<K, V> = indexmap::IndexMap<K, V, FxHasher>;
diff --git a/crates/salsa/src/input.rs b/crates/salsa/src/input.rs
index 922ec5a7752..f04f48e3bab 100644
--- a/crates/salsa/src/input.rs
+++ b/crates/salsa/src/input.rs
@@ -1,4 +1,3 @@
-//!
 use crate::debug::TableEntry;
 use crate::durability::Durability;
 use crate::hash::FxIndexMap;
diff --git a/crates/salsa/src/intern_id.rs b/crates/salsa/src/intern_id.rs
index a7bbc088f9c..b060d8aab68 100644
--- a/crates/salsa/src/intern_id.rs
+++ b/crates/salsa/src/intern_id.rs
@@ -1,4 +1,3 @@
-//!
 use std::fmt;
 use std::num::NonZeroU32;
 
diff --git a/crates/salsa/src/interned.rs b/crates/salsa/src/interned.rs
index c065e7e2bde..bfa9cc0591a 100644
--- a/crates/salsa/src/interned.rs
+++ b/crates/salsa/src/interned.rs
@@ -1,4 +1,3 @@
-//!
 use crate::debug::TableEntry;
 use crate::durability::Durability;
 use crate::intern_id::InternId;
diff --git a/crates/salsa/src/lib.rs b/crates/salsa/src/lib.rs
index fe807598873..f86683ee77a 100644
--- a/crates/salsa/src/lib.rs
+++ b/crates/salsa/src/lib.rs
@@ -1,8 +1,7 @@
-//!
 #![allow(clippy::type_complexity)]
 #![allow(clippy::question_mark)]
+#![allow(missing_docs)]
 #![warn(rust_2018_idioms)]
-#![warn(missing_docs)]
 
 //! The salsa crate is a crate for incremental recomputation.  It
 //! permits you to define a "database" of queries with both inputs and
@@ -124,9 +123,9 @@ pub struct Event {
 impl Event {
     /// Returns a type that gives a user-readable debug output.
     /// Use like `println!("{:?}", index.debug(db))`.
-    pub fn debug<'me, D: ?Sized>(&'me self, db: &'me D) -> impl std::fmt::Debug + 'me
+    pub fn debug<'me, D>(&'me self, db: &'me D) -> impl std::fmt::Debug + 'me
     where
-        D: plumbing::DatabaseOps,
+        D: ?Sized + plumbing::DatabaseOps,
     {
         EventDebug { event: self, db }
     }
@@ -206,9 +205,9 @@ pub enum EventKind {
 impl EventKind {
     /// Returns a type that gives a user-readable debug output.
     /// Use like `println!("{:?}", index.debug(db))`.
-    pub fn debug<'me, D: ?Sized>(&'me self, db: &'me D) -> impl std::fmt::Debug + 'me
+    pub fn debug<'me, D>(&'me self, db: &'me D) -> impl std::fmt::Debug + 'me
     where
-        D: plumbing::DatabaseOps,
+        D: ?Sized + plumbing::DatabaseOps,
     {
         EventKindDebug { kind: self, db }
     }
@@ -400,9 +399,9 @@ impl DatabaseKeyIndex {
 
     /// Returns a type that gives a user-readable debug output.
     /// Use like `println!("{:?}", index.debug(db))`.
-    pub fn debug<D: ?Sized>(self, db: &D) -> impl std::fmt::Debug + '_
+    pub fn debug<D>(self, db: &D) -> impl std::fmt::Debug + '_
     where
-        D: plumbing::DatabaseOps,
+        D: ?Sized + plumbing::DatabaseOps,
     {
         DatabaseKeyIndexDebug { index: self, db }
     }
diff --git a/crates/salsa/src/lru.rs b/crates/salsa/src/lru.rs
index 1ff85a3ea45..edad551842d 100644
--- a/crates/salsa/src/lru.rs
+++ b/crates/salsa/src/lru.rs
@@ -1,4 +1,3 @@
-//!
 use oorandom::Rand64;
 use parking_lot::Mutex;
 use std::fmt::Debug;
diff --git a/crates/salsa/src/plumbing.rs b/crates/salsa/src/plumbing.rs
index 1a8ff33b2ef..1dfde639869 100644
--- a/crates/salsa/src/plumbing.rs
+++ b/crates/salsa/src/plumbing.rs
@@ -1,4 +1,3 @@
-//!
 #![allow(missing_docs)]
 
 use crate::debug::TableEntry;
diff --git a/crates/salsa/src/revision.rs b/crates/salsa/src/revision.rs
index 559b0338608..204c0883b85 100644
--- a/crates/salsa/src/revision.rs
+++ b/crates/salsa/src/revision.rs
@@ -1,4 +1,3 @@
-//!
 use std::num::NonZeroU32;
 use std::sync::atomic::{AtomicU32, Ordering};
 
diff --git a/crates/salsa/src/runtime.rs b/crates/salsa/src/runtime.rs
index e11cabfe11e..4f3341f5150 100644
--- a/crates/salsa/src/runtime.rs
+++ b/crates/salsa/src/runtime.rs
@@ -1,4 +1,3 @@
-//!
 use crate::durability::Durability;
 use crate::hash::FxIndexSet;
 use crate::plumbing::CycleRecoveryStrategy;
@@ -605,7 +604,7 @@ impl ActiveQuery {
     pub(crate) fn take_inputs_from(&mut self, cycle_query: &ActiveQuery) {
         self.changed_at = cycle_query.changed_at;
         self.durability = cycle_query.durability;
-        self.dependencies = cycle_query.dependencies.clone();
+        self.dependencies.clone_from(&cycle_query.dependencies);
     }
 }
 
diff --git a/crates/salsa/src/runtime/dependency_graph.rs b/crates/salsa/src/runtime/dependency_graph.rs
index dd223eeeba9..ed1d499f637 100644
--- a/crates/salsa/src/runtime/dependency_graph.rs
+++ b/crates/salsa/src/runtime/dependency_graph.rs
@@ -1,4 +1,3 @@
-//!
 use triomphe::Arc;
 
 use crate::{DatabaseKeyIndex, RuntimeId};
diff --git a/crates/salsa/src/runtime/local_state.rs b/crates/salsa/src/runtime/local_state.rs
index 7ac21dec1a8..0dbea1d563e 100644
--- a/crates/salsa/src/runtime/local_state.rs
+++ b/crates/salsa/src/runtime/local_state.rs
@@ -1,4 +1,3 @@
-//!
 use tracing::debug;
 use triomphe::ThinArc;
 
diff --git a/crates/salsa/src/storage.rs b/crates/salsa/src/storage.rs
index c0e6416f4a3..e0acf44041b 100644
--- a/crates/salsa/src/storage.rs
+++ b/crates/salsa/src/storage.rs
@@ -1,4 +1,3 @@
-//!
 use crate::{plumbing::DatabaseStorageTypes, Runtime};
 use triomphe::Arc;
 
diff --git a/crates/sourcegen/src/lib.rs b/crates/sourcegen/src/lib.rs
index 295b716b4e9..829b4d5b0ff 100644
--- a/crates/sourcegen/src/lib.rs
+++ b/crates/sourcegen/src/lib.rs
@@ -69,7 +69,7 @@ impl CommentBlock {
                 panic!("Use plain (non-doc) comments with tags like {tag}:\n    {first}");
             }
 
-            block.id = id.trim().to_owned();
+            id.trim().clone_into(&mut block.id);
             true
         });
         blocks
diff --git a/crates/test-utils/src/fixture.rs b/crates/test-utils/src/fixture.rs
index 7e34c361899..aafe4fb5b10 100644
--- a/crates/test-utils/src/fixture.rs
+++ b/crates/test-utils/src/fixture.rs
@@ -186,7 +186,7 @@ impl FixtureWithProjectMeta {
 
         if let Some(meta) = fixture.strip_prefix("//- target_data_layout:") {
             let (meta, remain) = meta.split_once('\n').unwrap();
-            target_data_layout = meta.trim().to_owned();
+            meta.trim().clone_into(&mut target_data_layout);
             fixture = remain;
         }
 
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index 7dc1b40783c..b23d700263f 100644
--- a/xtask/src/codegen.rs
+++ b/xtask/src/codegen.rs
@@ -84,7 +84,7 @@ impl CommentBlock {
                 panic!("Use plain (non-doc) comments with tags like {tag}:\n    {first}");
             }
 
-            block.id = id.trim().to_owned();
+            id.trim().clone_into(&mut block.id);
             true
         });
         blocks
diff --git a/xtask/src/codegen/lints.rs b/xtask/src/codegen/lints.rs
index 63abcfc0904..6975f9328e5 100644
--- a/xtask/src/codegen/lints.rs
+++ b/xtask/src/codegen/lints.rs
@@ -280,7 +280,7 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) {
             let line = &line[..up_to];
 
             let clippy_lint = clippy_lints.last_mut().expect("clippy lint must already exist");
-            clippy_lint.help = unescape(line).trim().to_owned();
+            unescape(line).trim().clone_into(&mut clippy_lint.help);
         }
     }
     clippy_lints.sort_by(|lint, lint2| lint.id.cmp(&lint2.id));