Resolve clippy warnings
This commit is contained in:
@@ -122,7 +122,7 @@ fn rewrite_contents(contents: String, mut changes: HashMap<&str, String>) -> Opt
|
||||
// Take any new value, and update it
|
||||
if let Some((_, new)) = changes.remove_entry(key.trim().to_lowercase().as_str()) {
|
||||
if value != new {
|
||||
line = format!("{}={}", key, new);
|
||||
line = format!("{key}={new}");
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ fn rewrite_contents(contents: String, mut changes: HashMap<&str, String>) -> Opt
|
||||
|
||||
// Append any missed changes
|
||||
for (key, value) in changes {
|
||||
new_contents += &format!("{}{}={}", EOL, key, value);
|
||||
new_contents += &format!("{EOL}{key}={value}");
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@ fn player_uuid(username: &str) -> Uuid {
|
||||
|
||||
/// Get UUID for given offline player username.
|
||||
pub fn offline_player_uuid(username: &str) -> Uuid {
|
||||
player_uuid(&format!("{}{}", OFFLINE_PLAYER_NAMESPACE, username))
|
||||
player_uuid(&format!("{OFFLINE_PLAYER_NAMESPACE}{username}"))
|
||||
}
|
||||
|
||||
/// Java's `UUID.nameUUIDFromBytes`
|
||||
|
@@ -152,12 +152,8 @@ pub async fn serve(
|
||||
info!(target: "lazymc", "Login from banned IP {}, disconnecting", client.peer.ip());
|
||||
DEFAULT_BAN_REASON.to_string()
|
||||
};
|
||||
action::kick(
|
||||
&client,
|
||||
&format!("{}{}", BAN_MESSAGE_PREFIX, msg),
|
||||
&mut writer,
|
||||
)
|
||||
.await?;
|
||||
action::kick(&client, &format!("{BAN_MESSAGE_PREFIX}{msg}"), &mut writer)
|
||||
.await?;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ use crate::util::error::{quit_error, ErrorHints};
|
||||
/// excluding the `:` suffix.
|
||||
pub fn prompt(msg: &str) -> String {
|
||||
// Show the prompt
|
||||
eprint!("{}: ", msg);
|
||||
eprint!("{msg}: ");
|
||||
let _ = stderr().flush();
|
||||
|
||||
// Get the input
|
||||
@@ -49,7 +49,7 @@ pub fn prompt_yes(msg: &str, def: Option<bool>) -> bool {
|
||||
);
|
||||
|
||||
// Get the user input
|
||||
let answer = prompt(&format!("{} {}", msg, options));
|
||||
let answer = prompt(&format!("{msg} {options}"));
|
||||
|
||||
// Assume the default if the answer is empty
|
||||
if answer.is_empty() {
|
||||
|
@@ -16,7 +16,7 @@ pub fn print_error(err: anyhow::Error) {
|
||||
// Report each printable error, count them
|
||||
let count = err
|
||||
.chain()
|
||||
.map(|err| format!("{}", err))
|
||||
.map(|err| err.to_string())
|
||||
.filter(|err| !err.is_empty())
|
||||
.enumerate()
|
||||
.map(|(i, err)| {
|
||||
@@ -126,7 +126,7 @@ impl ErrorHints {
|
||||
if self.config_generate {
|
||||
eprintln!(
|
||||
"Use '{}' to generate a new config file",
|
||||
highlight(&format!("{} config generate", bin))
|
||||
highlight(&format!("{bin} config generate"))
|
||||
);
|
||||
}
|
||||
if self.config {
|
||||
@@ -138,7 +138,7 @@ impl ErrorHints {
|
||||
if self.config_test {
|
||||
eprintln!(
|
||||
"Use '{}' to test a config file",
|
||||
highlight(&format!("{} config test -c FILE", bin))
|
||||
highlight(&format!("{bin} config test -c FILE"))
|
||||
);
|
||||
}
|
||||
if self.verbose {
|
||||
|
Reference in New Issue
Block a user