new()
RS-W1079new()
114 FrameworkError::CommandStructureMismatch {
115 description, ctx, ..
116 } => {
117 let mut args = String::new();118 for param in &ctx.command.parameters {
119 if param.required {
120 write!(&mut args, "<{}> ", param.name)
new()
113 }
114
115 // format the guild counts into a string
116 let mut response = String::new();117 for group in GROUPS {
118 let count = guild_counts.get(&(group.start, group.end)).unwrap_or(&0);
119 // subtract 1 from the end because these ranges are exclusive
new()
138 .fetch_optional(scripty_db::get_db())
139 .await?
140 .map_or_else(
141 || (String::new(), false, false, false),142 |row| {
143 (
144 row.language,
new()
1/// Convert a &[u8] to a String by hex encoding it.
2pub fn vec_to_hex(vec: &[u8]) -> String {
3 let mut hex = String::new();4 for byte in vec {
5 hex.push_str(&format!("{:02x}", byte));
6 }
The new()
function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default()
.
Replace it with default()
instead.
fn foo() {
let s = String::new();
let p = Path::new();
}
fn foo() {
let s = String::default();
let p = Path::default();
}