chore: update prettyplease

This commit is contained in:
DaniPopes 2023-03-25 01:42:47 +01:00
parent 613c1ed423
commit f015a5c873
No known key found for this signature in database
GPG Key ID: 0F09640DDB7AC692
3 changed files with 12 additions and 14 deletions

16
Cargo.lock generated
View File

@ -1262,7 +1262,7 @@ dependencies = [
"reqwest", "reqwest",
"serde", "serde",
"serde_json", "serde_json",
"syn 2.0.0", "syn 2.0.9",
"tempfile", "tempfile",
"tokio", "tokio",
"toml", "toml",
@ -1281,7 +1281,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde_json", "serde_json",
"syn 2.0.0", "syn 2.0.9",
] ]
[[package]] [[package]]
@ -1308,7 +1308,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"strum", "strum",
"syn 2.0.0", "syn 2.0.9",
"tempfile", "tempfile",
"thiserror", "thiserror",
"tiny-keccak", "tiny-keccak",
@ -3023,12 +3023,12 @@ dependencies = [
[[package]] [[package]]
name = "prettyplease" name = "prettyplease"
version = "0.1.25" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" checksum = "c17f5e28f5d12fb805aea10d72d50d2d9b005b267e71c44d0a33a847e45ed795"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn 1.0.109", "syn 2.0.9",
] ]
[[package]] [[package]]
@ -3994,9 +3994,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.0" version = "2.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cff13bb1732bccfe3b246f3fdb09edfd51c01d6f5299b7ccd9457c2e4e37774" checksum = "0da4a3c17e109f700685ec577c0f85efd9b19bcf15c913985f14dc1ac01775aa"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View File

@ -31,7 +31,7 @@ ethers-core = { workspace = true, features = ["macros"] }
proc-macro2.workspace = true proc-macro2.workspace = true
quote.workspace = true quote.workspace = true
syn = { workspace = true, features = ["full"] } syn = { workspace = true, features = ["full"] }
prettyplease = "0.1.25" prettyplease = "0.2.1"
Inflector.workspace = true Inflector.workspace = true
serde.workspace = true serde.workspace = true

View File

@ -301,11 +301,9 @@ impl ToTokens for ContractBindings {
impl fmt::Display for ContractBindings { impl fmt::Display for ContractBindings {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.format { if self.format {
// TODO: let syntax_tree = syn::parse2::<syn::File>(self.tokens.clone()).unwrap();
todo!("enable formatting when prettyplease uses syn 2.0") let s = prettyplease::unparse(&syntax_tree);
// let syntax_tree = syn::parse2::<syn::File>(self.tokens.clone()).unwrap(); f.write_str(&s)
// let s = prettyplease::unparse(&syntax_tree);
// f.write_str(&s)
} else { } else {
fmt::Display::fmt(&self.tokens, f) fmt::Display::fmt(&self.tokens, f)
} }