Skip to content

fix: inline format strings #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion efi/src/pager/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Pager {
let line = &line[0..self.window.columns.min(line.len())];

if self.search_pattern.is_empty() {
let _ = writeln!(self.output, "{}", line);
let _ = writeln!(self.output, "{line}");
return Ok(());
}

Expand Down
2 changes: 1 addition & 1 deletion lib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn generate_headers() {
.map_or_else(
|error| match error {
cbindgen::Error::ParseSyntaxError { .. } => {}
e => panic!("{:?}", e),
e => panic!("{e:?}"),
},
|bindings| {
bindings.write_to_file(header);
Expand Down
6 changes: 3 additions & 3 deletions lib/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,11 @@ impl fmt::Display for Header {
let header_type = match self.header_type {
HeaderType::Type6 {
die_id, socket_id, ..
} => format!("die_id={0}, socket_id={1}", die_id, socket_id),
} => format!("die_id={die_id}, socket_id={socket_id}"),
_ => "..".to_string(),
};

write!(f, "{} - ({}, {})", record_type, version, header_type)
write!(f, "{record_type} - ({version}, {header_type})")
}
}

Expand Down Expand Up @@ -627,7 +627,7 @@ impl From<&Header> for Node {

for (i, completion_status) in completion_status.iter().enumerate() {
node.add(Node::field(
&format!("completion_status{}", i),
&format!("completion_status{i}"),
*completion_status as u64,
));
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ pub struct Time {
impl fmt::Display for Metadata {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match (self.computer.as_ref(), self.time.as_ref()) {
(Some(computer), Some(time)) => write!(f, "{}-{}", computer, time),
(None, Some(time)) => write!(f, "{}", time),
(Some(computer), None) => write!(f, "{}", computer),
(Some(computer), Some(time)) => write!(f, "{computer}-{time}"),
(None, Some(time)) => write!(f, "{time}"),
(Some(computer), None) => write!(f, "{computer}"),
(None, None) => write!(f, "unnamed"),
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl Node {
let mut instance = 0;
let name = other.name.clone();
while self.children.contains_key(&other.name) {
other.name = format!("{}{}", name, instance);
other.name = format!("{name}{instance}");
instance += 1
}
self.add(other)
Expand Down Expand Up @@ -259,10 +259,10 @@ impl Serialize for Node {
match self.kind {
NodeType::Field { value } => {
if self.children.is_empty() {
serializer.serialize_str(&format!("0x{:x}", value))
serializer.serialize_str(&format!("0x{value:x}"))
} else {
let mut map = serializer.serialize_map(Some(self.children.len() + 1))?;
map.serialize_entry("_value", &format!("0x{:x}", value))?;
map.serialize_entry("_value", &format!("0x{value:x}"))?;
for (k, v) in self.children.iter() {
map.serialize_entry(k, v)?;
}
Expand Down