Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

clippy: println_empty_string & non_minimal_cfg (#36614)

Piotr Osiewicz74ce543d8b16
diff --git a/Cargo.toml b/Cargo.toml
index 6218e8dbb9d..dcf07b70791 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -900,6 +900,7 @@ needless_parens_on_range_literals = "warn"
needless_pub_self = "warn"
needless_return = "warn"
needless_return_with_question_mark = "warn"
+non_minimal_cfg = "warn"
ok_expect = "warn"
owned_cow = "warn"
print_literal = "warn"
diff --git a/crates/agent2/src/thread.rs b/crates/agent2/src/thread.rs
index 01c9ab03ba4..62174fd3b47 100644
--- a/crates/agent2/src/thread.rs
+++ b/crates/agent2/src/thread.rs
@@ -161,7 +161,7 @@ impl UserMessage {
}
UserMessageContent::Mention { uri, content } => {
if !content.is_empty() {
- let _ = write!(&mut markdown, "{}\n\n{}\n", uri.as_link(), content);
+ let _ = writeln!(&mut markdown, "{}\n\n{}", uri.as_link(), content);
} else {
let _ = writeln!(&mut markdown, "{}", uri.as_link());
}
diff --git a/crates/gpui/src/taffy.rs b/crates/gpui/src/taffy.rs
index f198bb77184..58386ad1f50 100644
--- a/crates/gpui/src/taffy.rs
+++ b/crates/gpui/src/taffy.rs
@@ -164,7 +164,6 @@ impl TaffyLayoutEngine {
// for (a, b) in self.get_edges(id)? {
// println!("N{} --> N{}", u64::from(a), u64::from(b));
// }
- // println!("");
//
if !self.computed_layouts.insert(id) {
diff --git a/crates/gpui_macros/tests/derive_inspector_reflection.rs b/crates/gpui_macros/tests/derive_inspector_reflection.rs
index aab44a70ce5..a0adcb7801e 100644
--- a/crates/gpui_macros/tests/derive_inspector_reflection.rs
+++ b/crates/gpui_macros/tests/derive_inspector_reflection.rs
@@ -34,13 +34,6 @@ trait Transform: Clone {
/// Adds one to the value
fn add_one(self) -> Self;
-
- /// cfg attributes are respected
- #[cfg(all())]
- fn cfg_included(self) -> Self;
-
- #[cfg(any())]
- fn cfg_omitted(self) -> Self;
}
#[derive(Debug, Clone, PartialEq)]
@@ -70,10 +63,6 @@ impl Transform for Number {
fn add_one(self) -> Self {
Number(self.0 + 1)
}
-
- fn cfg_included(self) -> Self {
- Number(self.0)
- }
}
#[test]
@@ -83,14 +72,13 @@ fn test_derive_inspector_reflection() {
// Get all methods that match the pattern fn(self) -> Self or fn(mut self) -> Self
let methods = methods::<Number>();
- assert_eq!(methods.len(), 6);
+ assert_eq!(methods.len(), 5);
let method_names: Vec<_> = methods.iter().map(|m| m.name).collect();
assert!(method_names.contains(&"double"));
assert!(method_names.contains(&"triple"));
assert!(method_names.contains(&"increment"));
assert!(method_names.contains(&"quadruple"));
assert!(method_names.contains(&"add_one"));
- assert!(method_names.contains(&"cfg_included"));
// Invoke methods by name
let num = Number(5);
diff --git a/crates/tab_switcher/src/tab_switcher.rs b/crates/tab_switcher/src/tab_switcher.rs
index 655b8a2e8f4..11e32523b49 100644
--- a/crates/tab_switcher/src/tab_switcher.rs
+++ b/crates/tab_switcher/src/tab_switcher.rs
@@ -307,7 +307,6 @@ impl TabSwitcherDelegate {
(Reverse(history.get(&item.item.item_id())), item.item_index)
)
}
- eprintln!();
all_items
.sort_by_key(|tab| (Reverse(history.get(&tab.item.item_id())), tab.item_index));
all_items