mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
Use str::repeat
This commit is contained in:
parent
09940a70d0
commit
e3a4a03657
@ -236,10 +236,7 @@ macro_rules! create_config {
|
||||
use std::cmp;
|
||||
let max = 0;
|
||||
$( let max = cmp::max(max, stringify!($i).len()+1); )+
|
||||
let mut space_str = String::with_capacity(max);
|
||||
for _ in 0..max {
|
||||
space_str.push(' ');
|
||||
}
|
||||
let space_str = " ".repeat(max);
|
||||
writeln!(out, "Configuration Options:").unwrap();
|
||||
$(
|
||||
if $stb || include_unstable {
|
||||
|
@ -540,17 +540,12 @@ fn register_metavariable(
|
||||
name: &str,
|
||||
dollar_count: usize,
|
||||
) {
|
||||
let mut new_name = String::new();
|
||||
let mut old_name = String::new();
|
||||
let mut new_name = "$".repeat(dollar_count - 1);
|
||||
let mut old_name = "$".repeat(dollar_count);
|
||||
|
||||
old_name.push('$');
|
||||
for _ in 0..(dollar_count - 1) {
|
||||
new_name.push('$');
|
||||
old_name.push('$');
|
||||
}
|
||||
new_name.push('z');
|
||||
new_name.push_str(&name);
|
||||
old_name.push_str(&name);
|
||||
new_name.push_str(name);
|
||||
old_name.push_str(name);
|
||||
|
||||
result.push_str(&new_name);
|
||||
map.insert(old_name, new_name);
|
||||
|
Loading…
Reference in New Issue
Block a user