clippy: println_empty_string & non_minimal_cfg (#36614)

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

Related to #36577

Release Notes:
- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-20 20:45:40 +02:00 committed by GitHub
parent b6722ca3c8
commit 74ce543d8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 3 additions and 16 deletions

View file

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

View file

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

View file

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

View file

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

View file

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