summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index af772ca..b201fd6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -36,9 +36,9 @@ fn main() -> Result<()> {
exit(0);
}
if cli.list_models {
- config::MODELS
- .iter()
- .for_each(|(name, _)| println!("{}", name));
+ for (name, _) in &config::MODELS {
+ println!("{name}");
+ }
exit(0);
}
if cli.dry_run {
@@ -76,18 +76,18 @@ fn main() -> Result<()> {
if let Some(text) = text {
input = format!("{text}\n{input}");
}
- start_directive(client, config, &input, no_stream)
+ start_directive(&client, &config, &input, no_stream)
} else {
match text {
- Some(text) => start_directive(client, config, &text, no_stream),
+ Some(text) => start_directive(&client, &config, &text, no_stream),
None => start_interactive(client, config),
}
}
}
fn start_directive(
- client: ChatGptClient,
- config: SharedConfig,
+ client: &ChatGptClient,
+ config: &SharedConfig,
input: &str,
no_stream: bool,
) -> Result<()> {
@@ -113,7 +113,7 @@ fn start_directive(
abort_clone.set_ctrlc();
})
.expect("Error setting Ctrl-C handler");
- let output = render_stream(input, &client, config.clone(), false, abort, wg.clone())?;
+ let output = render_stream(input, client, config, false, abort, wg.clone())?;
wg.wait();
output
};