Skip to content

Commit 3d45a08

Browse files
committed
updates
Signed-off-by: Jessie Frazelle <github@jessfraz.com>
1 parent 9038a7b commit 3d45a08

File tree

9 files changed

+28
-29
lines changed

9 files changed

+28
-29
lines changed

cli-macro-impl/src/lib.rs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl Operation {
201201
Err(_) => return false,
202202
};
203203

204-
if parameter_data.name == parameter || parameter_data.name.starts_with(&format!("{}_", parameter)) {
204+
if parameter_data.name == parameter || parameter_data.name.starts_with(&format!("{parameter}_")) {
205205
return true;
206206
}
207207
}
@@ -281,7 +281,7 @@ impl Operation {
281281
if self.method == "PUT" {
282282
// We add the `new_` part onto the parameter since it will be
283283
// overwriting an existing field.
284-
key = format!("new_{}", key);
284+
key = format!("new_{key}");
285285
}
286286

287287
properties.insert(
@@ -516,11 +516,11 @@ impl Operation {
516516
)
517517
.replace(" dns ", " DNS ")
518518
} else if name == "description" {
519-
format!("The description for the {}.", prop)
519+
format!("The description for the {prop}.")
520520
} else if self.is_root_list_operation(tag) {
521521
format!("The {} that holds the {}.", n, plural(&prop))
522522
} else {
523-
format!("The {} that holds the {}.", n, prop)
523+
format!("The {n} that holds the {prop}.")
524524
};
525525

526526
let mut type_name = self.render_type(schema, required)?;
@@ -615,7 +615,7 @@ impl Operation {
615615
&singular(tag)
616616
);
617617

618-
let struct_inner_name_doc = format!("The name of the {} to create.", singular_tag_str);
618+
let struct_inner_name_doc = format!("The name of the {singular_tag_str} to create.");
619619

620620
let mut mutable_variables: Vec<TokenStream> = Vec::new();
621621
for (p, _) in self.get_all_required_param_names_and_types()? {
@@ -642,13 +642,13 @@ impl Operation {
642642

643643
let formatted = if n == singular(tag) {
644644
// Format like an argument not a flag.
645-
format!("[{}]", n)
645+
format!("[{n}]")
646646
} else {
647647
let flags = get_flags(&n)?;
648648
flags.format_help()
649649
};
650650

651-
let error_msg = format!("{} required in non-interactive mode", formatted);
651+
let error_msg = format!("{formatted} required in non-interactive mode");
652652

653653
let is_check = self.get_is_check_fn(t, true)?;
654654

@@ -685,7 +685,7 @@ impl Operation {
685685

686686
let p = format_ident!("{}", n);
687687

688-
let title = format!("{} {}", singular_tag_str, n);
688+
let title = format!("{singular_tag_str} {n}");
689689

690690
let is_check = self.get_is_check_fn(v.clone(), true)?;
691691

@@ -843,9 +843,9 @@ impl Operation {
843843
let singular_tag_lc = format_ident!("{}", singular(tag));
844844
let struct_name = format_ident!("Cmd{}Edit", to_title_case(&singular(tag)));
845845

846-
let struct_doc = format!("Edit {} settings.", singular_tag_str,);
846+
let struct_doc = format!("Edit {singular_tag_str} settings.",);
847847

848-
let struct_inner_name_doc = format!("The {} to edit. Can be an ID or name.", singular_tag_str);
848+
let struct_inner_name_doc = format!("The {singular_tag_str} to edit. Can be an ID or name.");
849849

850850
let api_call_params = self.get_api_call_params(tag)?;
851851

@@ -955,12 +955,11 @@ impl Operation {
955955
let struct_name = format_ident!("Cmd{}View", to_title_case(&singular(tag)));
956956

957957
let struct_doc = format!(
958-
"View {}.\n\nDisplay information about a Zoo {}.\n\nWith `--web`, open the {} in a web browser instead.",
959-
singular_tag_str, singular_tag_str, singular_tag_str
958+
"View {singular_tag_str}.\n\nDisplay information about a Zoo {singular_tag_str}.\n\nWith `--web`, open the {singular_tag_str} in a web browser instead."
960959
);
961960

962-
let struct_inner_web_doc = format!("Open the {} in the browser.", singular_tag_str);
963-
let struct_inner_name_doc = format!("The {} to view. Can be an ID or name.", singular_tag_str);
961+
let struct_inner_web_doc = format!("Open the {singular_tag_str} in the browser.");
962+
let struct_inner_name_doc = format!("The {singular_tag_str} to view. Can be an ID or name.");
964963

965964
let api_call_params = self.get_api_call_params(tag)?;
966965

@@ -1137,8 +1136,8 @@ impl Operation {
11371136
let singular_tag_lc = format_ident!("{}", singular(tag));
11381137
let struct_name = format_ident!("Cmd{}Delete", to_title_case(&singular(tag)));
11391138

1140-
let struct_doc = format!("Delete {}.", singular_tag_str);
1141-
let struct_inner_name_doc = format!("The {} to delete. Can be an ID or name.", singular_tag_str);
1139+
let struct_doc = format!("Delete {singular_tag_str}.");
1140+
let struct_inner_name_doc = format!("The {singular_tag_str} to delete. Can be an ID or name.");
11421141

11431142
let api_call_params = self.get_api_call_params(tag)?;
11441143

@@ -1345,12 +1344,12 @@ fn plural(s: &str) -> String {
13451344
let s = singular(s);
13461345

13471346
if s.ends_with('s') {
1348-
return format!("{}es", s);
1347+
return format!("{s}es");
13491348
} else if s.ends_with('y') {
13501349
return format!("{}ies", s.trim_end_matches('y'));
13511350
}
13521351

1353-
format!("{}s", s)
1352+
format!("{s}s")
13541353
}
13551354

13561355
/// Return the singular version of a string (if it plural).

rust-toolchain.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "stable"
3-
components = [ "rustfmt", "clippy" ]
2+
channel = "1.88"
3+
components = ["rustfmt", "clippy"]

src/cmd_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl crate::cmd::Command for CmdConfigList {
151151
for option in CONFIG_OPTIONS {
152152
if let &ConfigOption::TopLevel { key, description, .. } = option {
153153
match ctx.config.get(&host, key) {
154-
Ok(value) => writeln!(ctx.io.out, "{}\n{}={}\n", description, key, value)?,
154+
Ok(value) => writeln!(ctx.io.out, "{description}\n{key}={value}\n")?,
155155
Err(err) => {
156156
if host.is_empty() {
157157
// Only bail if the host is empty, since some hosts may not have

src/cmd_generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl CmdGenerateMarkdown {
6161

6262
let mut p = parent.to_string();
6363
if !p.is_empty() {
64-
p = format!("{}_{}", p, name);
64+
p = format!("{p}_{name}");
6565
} else {
6666
p = name.to_string();
6767
}

src/cmd_kcl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl crate::cmd::Command for CmdKclFormat {
229229
}
230230
} else {
231231
// Print the formatted file to stdout.
232-
writeln!(ctx.io.out, "{}", formatted)?;
232+
writeln!(ctx.io.out, "{formatted}")?;
233233
}
234234

235235
Ok(())
@@ -1029,7 +1029,7 @@ fn print_trace_link(io: &mut IoStreams, session_data: &Option<kittycad::types::M
10291029
return;
10301030
};
10311031
let api_call_id = &data.api_call_id;
1032-
let link = format!("https://ui.honeycomb.io/kittycad/environments/prod/datasets/api-deux?query=%7B%22time_range%22%3A7200%2C%22granularity%22%3A0%2C%22calculations%22%3A%5B%7B%22op%22%3A%22COUNT%22%7D%5D%2C%22filters%22%3A%5B%7B%22column%22%3A%22api_call.id%22%2C%22op%22%3A%22%3D%22%2C%22value%22%3A%22{}%22%7D%5D%2C%22filter_combination%22%3A%22AND%22%2C%22limit%22%3A1000%7D", api_call_id);
1032+
let link = format!("https://ui.honeycomb.io/kittycad/environments/prod/datasets/api-deux?query=%7B%22time_range%22%3A7200%2C%22granularity%22%3A0%2C%22calculations%22%3A%5B%7B%22op%22%3A%22COUNT%22%7D%5D%2C%22filters%22%3A%5B%7B%22column%22%3A%22api_call.id%22%2C%22op%22%3A%22%3D%22%2C%22value%22%3A%22{api_call_id}%22%7D%5D%2C%22filter_combination%22%3A%22AND%22%2C%22limit%22%3A1000%7D");
10331033
let _ = writeln!(
10341034
io.out,
10351035
"Was this request slow? Send a Zoo employee this link:\n----\n{link}"

src/cmd_ml/cmd_kcl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl crate::cmd::Command for CmdKclEdit {
8888
for (file, output) in outputs {
8989
// We could do these in parallel...
9090
tokio::fs::write(&file, output).await?;
91-
writeln!(ctx.io.out, "Wrote to {}", file)?;
91+
writeln!(ctx.io.out, "Wrote to {file}")?;
9292
}
9393

9494
Ok(())

src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ pub fn new_blank_root() -> Result<toml_edit::DocumentMut> {
182182
} = option
183183
{
184184
if !comment.is_empty() {
185-
writeln!(s, "# {}", comment)?;
185+
writeln!(s, "# {comment}")?;
186186
if !allowed_values.is_empty() {
187187
writeln!(s, "# Supported values: {}", allowed_values.join(", "))?;
188188
}
189189
}
190-
writeln!(s, "{} = \"{}\"\n", key, default_value)?;
190+
writeln!(s, "{key} = \"{default_value}\"\n")?;
191191
}
192192
}
193193

src/docs_markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn do_markdown(doc: &mut MarkdownDocument, app: &Command, title: &str) -> Result
7373

7474
let mut html = "<dl class=\"flags\">\n".to_string();
7575

76-
println!("{:#?}", args);
76+
println!("{args:#?}");
7777

7878
for (i, arg) in args.iter().enumerate() {
7979
if i > 0 {

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ async fn run_cmd(cmd: &impl crate::cmd::Command, ctx: &mut context::Context<'_>)
299299
writeln!(ctx.io.err_out, "Try authenticating with: `zoo auth login`")?;
300300
} else if let kittycad::types::error::Error::UnexpectedResponse(resp) = err {
301301
let body = resp.text().await?;
302-
writeln!(ctx.io.err_out, "zoo.dev api error: {}", body)?;
302+
writeln!(ctx.io.err_out, "zoo.dev api error: {body}")?;
303303
} else {
304304
writeln!(ctx.io.err_out, "{err}")?;
305305
}

0 commit comments

Comments
 (0)