Skip to content

Commit a76b3e8

Browse files
committed
Fix code formatting
Applied cargo fmt to clean up the code style across all files. The changes are mostly about consistent spacing between code blocks and proper import ordering.
1 parent 6c40e02 commit a76b3e8

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

build.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ use std::path::Path;
55

66
fn main() {
77
let out_dir = env::var("OUT_DIR").unwrap();
8-
8+
99
// Read and process adjectives
1010
let adjectives_path = Path::new("data/adjectives.txt");
1111
let dest_path = Path::new(&out_dir).join("adjectives.rs");
1212
process_word_list(adjectives_path, &dest_path);
13-
13+
1414
// Read and process nouns
1515
let nouns_path = Path::new("data/nouns.txt");
1616
let dest_path = Path::new(&out_dir).join("nouns.rs");
1717
process_word_list(nouns_path, &dest_path);
18-
18+
1919
// Tell Cargo to rerun if word lists change
2020
println!("cargo:rerun-if-changed=data/adjectives.txt");
2121
println!("cargo:rerun-if-changed=data/nouns.txt");
@@ -25,9 +25,9 @@ fn process_word_list(input_path: &Path, output_path: &Path) {
2525
let file = File::open(input_path).expect("Unable to open word list file");
2626
let reader = BufReader::new(file);
2727
let mut output = File::create(output_path).expect("Unable to create output file");
28-
28+
2929
write!(&mut output, "[").unwrap();
30-
30+
3131
let mut first = true;
3232
for line in reader.lines() {
3333
let word = line.unwrap().trim().to_string();
@@ -39,6 +39,6 @@ fn process_word_list(input_path: &Path, output_path: &Path) {
3939
first = false;
4040
}
4141
}
42-
42+
4343
write!(&mut output, "]").unwrap();
44-
}
44+
}

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use rand::Rng;
12
use rand::seq::SliceRandom;
23
use rand::thread_rng;
3-
use rand::Rng;
44

55
const ADJECTIVES: &[&str] = &include!(concat!(env!("OUT_DIR"), "/adjectives.rs"));
66
const NOUNS: &[&str] = &include!(concat!(env!("OUT_DIR"), "/nouns.rs"));
@@ -99,4 +99,4 @@ mod tests {
9999
let name = generator.next().unwrap();
100100
assert_eq!(name, "test-name");
101101
}
102-
}
102+
}

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ struct Cli {
1919

2020
fn main() {
2121
let cli = Cli::parse();
22-
22+
2323
let naming = if cli.number {
2424
Name::Numbered
2525
} else {
2626
Name::Plain
2727
};
28-
28+
2929
let mut generator = Generator::with_naming(naming);
30-
30+
3131
for _ in 0..cli.amount {
3232
if let Some(name) = generator.next() {
3333
println!("{}", name);

0 commit comments

Comments
 (0)