clippy: println_empty_string & non_minimal_cfg (#36614)

Piotr Osiewicz created

- **clippy: Fix println-empty-string**
- **clippy: non-minimal-cfg**

Related to #36577

Release Notes:
- N/A

Change summary

Cargo.toml                                              |  1 
crates/agent2/src/thread.rs                             |  2 
crates/gpui/src/taffy.rs                                |  1 
crates/gpui_macros/tests/derive_inspector_reflection.rs | 14 ----------
crates/tab_switcher/src/tab_switcher.rs                 |  1 
5 files changed, 3 insertions(+), 16 deletions(-)

Detailed changes

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"

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());
                     }

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) {

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

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