Skip to content

Commit 1c1a840

Browse files
committed
Apply cargo fmt suggestions
1 parent f34897d commit 1c1a840

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/main.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ mod module;
99

1010
use module::{Module, ModuleType};
1111

12-
1312
/// This struct stores options based on the command-line arguments,
1413
/// and is passed to various functions across the program.
1514
pub struct Options {
@@ -71,16 +70,20 @@ fn main() {
7170
assert!(!include_statements.is_empty());
7271

7372
// Generate the populated assembly module
74-
let populated = Module::new(ModuleType::Assembly, title, &options)
75-
.includes(include_statements);
73+
let populated =
74+
Module::new(ModuleType::Assembly, title, &options).includes(include_statements);
7675

7776
write_module(&populated, &options);
7877
}
7978
}
8079

8180
/// Process all titles that have been specified on the command line and that belong to a single
8281
/// module type.
83-
fn process_module_type(titles: clap::Values, module_type_str: &str, options: &Options) -> Vec<Module> {
82+
fn process_module_type(
83+
titles: clap::Values,
84+
module_type_str: &str,
85+
options: &Options,
86+
) -> Vec<Module> {
8487
let mut modules_from_type = Vec::new();
8588

8689
for title in titles {
@@ -103,7 +106,6 @@ fn process_module_type(titles: clap::Values, module_type_str: &str, options: &Op
103106
modules_from_type
104107
}
105108

106-
107109
/// Write the generated module content to the path specified in `options` with the set file name.
108110
// fn write_module(file_name: &str, content: &str, options: &Options) {
109111
fn write_module(module: &Module, options: &Options) {
@@ -156,4 +158,3 @@ fn write_module(module: &Module, options: &Options) {
156158
}
157159
}
158160
}
159-

src/module.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ const REFERENCE_TEMPLATE: &str = include_str!("../templates/reference.adoc");
2828

2929
impl Module {
3030
/// The constructor for the Module struct
31-
pub fn new(
32-
mod_type: ModuleType,
33-
title: &str,
34-
options: &Options,
35-
) -> Module {
31+
pub fn new(mod_type: ModuleType, title: &str, options: &Options) -> Module {
3632
let title = String::from(title);
3733
let id = Module::convert_title_to_id(&title);
3834
let file_name = Module::compose_file_name(&id, &mod_type, &options);
@@ -133,10 +129,7 @@ impl Module {
133129

134130
/// Perform string replacements in the modular template that matches the `ModuleType`.
135131
/// Return the template text with all replacements.
136-
pub fn compose_text(
137-
&self,
138-
options: &Options,
139-
) -> String {
132+
pub fn compose_text(&self, options: &Options) -> String {
140133
// TODO: Add a comment in the generated file with a pre-filled include statement
141134

142135
// Pick the right template

0 commit comments

Comments
 (0)