diff options
| author | Anthony Rubick <68485672+AnthonyMichaelTDM@users.noreply.github.com> | 2023-07-09 20:07:09 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-10 11:07:09 +0800 |
| commit | 97fc7de6754c8b5c383d7d5e3f9e26b3bbfb08fb (patch) | |
| tree | c19390877425fa50049761e8ee6bc93f21c46f56 /src/main.rs | |
| parent | ec51b84290215d11d5045de8baa9b89f2447b1e9 (diff) | |
| download | aichat-97fc7de6754c8b5c383d7d5e3f9e26b3bbfb08fb.tar.gz | |
fix: minor code cleanup and pedantic lints (#134)
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 16 |
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 }; |
