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