new()
RS-W1079new()
183
184fn collect_macros(program: &mut Program) -> Result<()> {
185 let mut macro_body = Vec::new();
186 let mut macro_name = String::new();187 let mut macro_stack = Vec::new();
188 let mut in_macro = false;
189
new()
692 println!("Location: {}", err_loc(&inst.loc));
693 println!("Stack: {:?}", stack);
694 println!("Snapshots: {}\n", snapshots.len());
695 std::io::stdin().read_line(&mut String::new()).unwrap();696 }
697
698 ip += 1;
new()
382
383 fmt_tokens.push(FmtToken {
384 indent_level: 0,
385 prefix: String::new(),386 color: String::new(),
387 value: token_str.clone(),
388 postcolor: String::new(),
new()
385 prefix: String::new(),
386 color: String::new(),
387 value: token_str.clone(),
388 postcolor: String::new(),389 postfix: String::new(),
390 loc: &token.loc,
391 kind: FmtTokenKind::Instruction(token.kind.clone()),
new()
386 color: String::new(),
387 value: token_str.clone(),
388 postcolor: String::new(),
389 postfix: String::new(),390 loc: &token.loc,
391 kind: FmtTokenKind::Instruction(token.kind.clone()),
392 });
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();
}