Skip to content

Commit f0541b5

Browse files
Merge pull request #252 from 1Password/update-for-new-clippy-lints
Update for newer clippy lints
2 parents 8c8041c + 4658ba4 commit f0541b5

13 files changed

Lines changed: 53 additions & 62 deletions

File tree

Cargo.lock

Lines changed: 13 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ ci = ["github"]
1313
installers = ["shell", "powershell"]
1414
# Target platforms to build apps for (Rust target-triple syntax)
1515
targets = [
16-
"x86_64-unknown-linux-gnu",
17-
"x86_64-apple-darwin",
18-
"x86_64-pc-windows-msvc",
19-
"aarch64-apple-darwin",
16+
"x86_64-unknown-linux-gnu",
17+
"x86_64-apple-darwin",
18+
"x86_64-pc-windows-msvc",
19+
"aarch64-apple-darwin",
2020
]
2121

2222
[profile.test]
@@ -35,4 +35,4 @@ inherits = "release"
3535

3636
[workspace.dependencies]
3737
log = "0.4"
38-
flexi_logger = "0.28"
38+
flexi_logger = "0.30"

cli/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ python = []
1717

1818
[dependencies]
1919
clap = { version = "4.5", features = [
20-
"cargo",
21-
"derive",
22-
"unicode",
23-
"wrap_help",
20+
"cargo",
21+
"derive",
22+
"unicode",
23+
"wrap_help",
2424
] }
2525
ignore = "0.4"
2626
once_cell = "1"
@@ -30,5 +30,5 @@ typeshare-core = { path = "../core", version = "=1.13.2" }
3030
log.workspace = true
3131
flexi_logger.workspace = true
3232
anyhow = "1"
33-
clap_complete = "4.5.32"
33+
clap_complete = "4.5"
3434
crossbeam = "0.8"

cli/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub(crate) fn load_config(file_path: Option<&Path>) -> Result<Config, io::Error>
101101

102102
if let Some(file_path) = file_path {
103103
let config_string = fs::read_to_string(file_path)?;
104-
toml::from_str(&config_string).map_err(|e| io::Error::new(io::ErrorKind::Other, e))
104+
toml::from_str(&config_string).map_err(io::Error::other)
105105
} else {
106106
Ok(Config::default())
107107
}

core/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ repository = "https://github.com/1Password/typeshare"
1010
proc-macro2 = "1"
1111
quote = "1"
1212
syn = { version = "2", features = ["full", "visit"] }
13-
thiserror = "1"
14-
itertools = "0.12"
13+
thiserror = "2"
14+
itertools = "0.14"
1515
lazy_format = "2"
16-
joinery = "2"
17-
topological-sort = { version = "0.2.2"}
18-
convert_case = { version = "0.6.0"}
16+
joinery = "3.1"
17+
topological-sort = { version = "0.2.2" }
18+
convert_case = { version = "0.8" }
1919
log.workspace = true
2020
flexi_logger.workspace = true
2121

core/src/language/go.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl Language for Go {
196196
"type {} {}\n",
197197
self.acronyms_to_uppercase(&ty.id.original),
198198
self.format_type(&ty.r#type, &[])
199-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?
199+
.map_err(std::io::Error::other)?
200200
)?;
201201

202202
Ok(())
@@ -207,7 +207,7 @@ impl Language for Go {
207207
RustConstExpr::Int(val) => {
208208
let const_type = self
209209
.format_type(&c.r#type, &[])
210-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
210+
.map_err(std::io::Error::other)?;
211211
writeln!(
212212
w,
213213
"const {} {} = {}",
@@ -506,7 +506,7 @@ func ({short_name} {full_name}) MarshalJSON() ([]byte, error) {{
506506
Some(type_override) => type_override.to_owned(),
507507
None => self
508508
.format_type(&field.ty, generic_types)
509-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?,
509+
.map_err(std::io::Error::other)?,
510510
};
511511

512512
let go_type = self.acronyms_to_uppercase(&type_name);

core/src/language/kotlin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl Language for Kotlin {
172172
.then(|| format!("<{}>", ty.generic_types.join(", ")))
173173
.unwrap_or_default(),
174174
self.format_type(&ty.r#type, ty.generic_types.as_slice())
175-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?
175+
.map_err(std::io::Error::other)?
176176
)?;
177177
}
178178

@@ -366,7 +366,7 @@ impl Kotlin {
366366
)?;
367367
let variant_type = self
368368
.format_type(ty, e.shared().generic_types.as_slice())
369-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
369+
.map_err(std::io::Error::other)?;
370370
write!(w, "val {}: {}", content_key, variant_type)?;
371371
write!(w, ")")?;
372372
}
@@ -445,7 +445,7 @@ impl Kotlin {
445445
Some(type_override) => type_override.to_owned(),
446446
None => self
447447
.format_type(&f.ty, generic_types)
448-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?,
448+
.map_err(std::io::Error::other)?,
449449
};
450450

451451
match visibility {

core/src/language/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ pub trait Language {
354354
///
355355
/// This function will write out:
356356
///
357-
/// ```compile_fail
357+
/// ```rust
358358
/// /// Generated type representing the anonymous struct variant `<make_struct_name>` of the `AlgebraicEnum` rust enum
359359
/// /* the struct definition for whatever language */
360360
/// ```

core/src/language/python.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl Language for Python {
273273
fn write_type_alias(&mut self, w: &mut dyn Write, ty: &RustTypeAlias) -> std::io::Result<()> {
274274
let r#type = self
275275
.format_type(&ty.r#type, ty.generic_types.as_slice())
276-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
276+
.map_err(std::io::Error::other)?;
277277

278278
writeln!(
279279
w,
@@ -295,7 +295,7 @@ impl Language for Python {
295295
RustConstExpr::Int(val) => {
296296
let const_type = self
297297
.format_type(&c.r#type, &[])
298-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
298+
.map_err(std::io::Error::other)?;
299299
writeln!(
300300
w,
301301
"{}: {} = {}",
@@ -446,7 +446,7 @@ impl Python {
446446
let not_optional_but_default = !field.ty.is_optional() && field.has_default;
447447
let python_type = self
448448
.format_type(&field.ty, generic_types)
449-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
449+
.map_err(std::io::Error::other)?;
450450
let python_field_name = python_property_aware_rename(&field.id.original);
451451
let is_aliased = python_field_name != field.id.renamed;
452452
let custom_translations = json_translation_for_type(&python_type);
@@ -671,7 +671,7 @@ impl Python {
671671
} => {
672672
let tuple_name = self
673673
.format_type(ty, shared.generic_types.as_slice())
674-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
674+
.map_err(std::io::Error::other)?;
675675
self.write_variant_class(
676676
&variant_class_name,
677677
tag_key,

core/src/language/scala.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl Language for Scala {
151151
.then(|| format!("[{}]", ty.generic_types.join(", ")))
152152
.unwrap_or_default(),
153153
self.format_type(&ty.r#type, ty.generic_types.as_slice())
154-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?
154+
.map_err(std::io::Error::other)?
155155
)?;
156156

157157
Ok(())
@@ -295,7 +295,7 @@ impl Scala {
295295
)?;
296296
let variant_type = self
297297
.format_type(ty, e.shared().generic_types.as_slice())
298-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
298+
.map_err(std::io::Error::other)?;
299299
write!(w, "{}: {}", content_key, variant_type)?;
300300
write!(w, ")")?;
301301
}
@@ -370,7 +370,7 @@ impl Scala {
370370
Some(type_override) => type_override.to_owned(),
371371
None => self
372372
.format_type(&f.ty, generic_types)
373-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?,
373+
.map_err(std::io::Error::other)?,
374374
};
375375

376376
write!(

0 commit comments

Comments
 (0)