diff --git a/Cargo.lock b/Cargo.lock index 7cf9673..7ee94f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,9 +31,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -100,13 +100,13 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -169,9 +169,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" @@ -190,9 +190,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -270,7 +270,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -380,11 +380,11 @@ dependencies = [ [[package]] name = "crossterm" -version = "0.25.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" +checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "crossterm_winapi", "libc", "mio", @@ -415,9 +415,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ "csv-core", "itoa", @@ -427,9 +427,9 @@ dependencies = [ [[package]] name = "csv-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" dependencies = [ "memchr", ] @@ -504,9 +504,15 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.3" @@ -637,7 +643,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -709,7 +715,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -722,6 +728,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" + [[package]] name = "heck" version = "0.4.1" @@ -748,9 +760,9 @@ checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex-literal" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hostname" @@ -862,7 +874,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +dependencies = [ + "equivalent", + "hashbrown 0.14.1", ] [[package]] @@ -896,9 +918,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] @@ -929,15 +951,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.148" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libm" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libz-sys" @@ -966,9 +988,9 @@ checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -1003,9 +1025,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "memchr" -version = "2.6.3" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memoffset" @@ -1153,9 +1175,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", "libm", @@ -1201,7 +1223,7 @@ version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if", "foreign-types", "libc", @@ -1218,7 +1240,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1251,13 +1273,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.4.1", "smallvec", "windows-targets", ] @@ -1331,9 +1353,9 @@ checksum = "68a61082d8bceecd71a3870e9162002bb75f7ba9c7aa8b76227e887782fef9c8" [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -1412,11 +1434,20 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "regex" -version = "1.9.6" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", @@ -1426,9 +1457,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.9" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -1437,9 +1468,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" @@ -1531,7 +1562,7 @@ version = "0.38.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2f9da0cbd88f9f09e7814e388301c8414c51c62aa6ce1e4b5c551d49d96e531" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -1584,22 +1615,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1772,7 +1803,7 @@ dependencies = [ "futures", "hematite-nbt", "hex-literal", - "indexmap", + "indexmap 2.0.2", "itertools", "more-asserts", "num", @@ -1814,7 +1845,7 @@ version = "0.1.2" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] @@ -1862,9 +1893,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.37" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -1879,7 +1910,7 @@ checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "redox_syscall 0.3.5", "rustix", "windows-sys", ] @@ -1901,7 +1932,7 @@ checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1949,9 +1980,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -1974,7 +2005,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -2044,11 +2075,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2056,20 +2086,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] @@ -2248,7 +2278,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -2282,7 +2312,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index dfae676..4e01832 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ homepage = "https://github.com/andrewgazelka/SwarmBot" [dependencies] # parsing arguments -clap = { version = "4.0.32", features = ["derive"] } +clap = { version = "4.4.6", features = ["derive"] } # reading from csv -csv = "1.1" +csv = "1.3" # serialization, deserialization serde = { version = "1.0", features = ["derive"] } @@ -26,7 +26,7 @@ serde = { version = "1.0", features = ["derive"] } tokio-socks = "0.5" # tokio -tokio = { version = "1.24", features = [ +tokio = { version = "1.33", features = [ "rt", "io-std", "io-util", @@ -47,10 +47,10 @@ flate2 = { version = "1.0", features = [ ], default-features = false } # get_u8, etc extensions -bytes = "1.1" +bytes = "1.5" # threads -rayon = "1.5" +rayon = "1.8" # mojang https api reqwest = { version = "0.11", features = ["json", "socks"] } @@ -72,15 +72,15 @@ sha1 = "0.10" serde_json = "1.0" # quite a few uses -itertools = "0.10" +itertools = "0.11" # for data storage # chat parsing -regex = "1.5" +regex = "1.10" # efficient hashmap -indexmap = { version = "1.7", features = ["std"] } +indexmap = { version = "2.0", features = ["std"] } float-ord = "0.3" @@ -88,12 +88,12 @@ float-ord = "0.3" num = "0.4" # for printing stuff out -crossterm = "0.25" +crossterm = "0.27" colored = "2.0" # for small stack-allocated arrays -smallvec = { version = "1.7", features = ["const_generics"] } +smallvec = { version = "1.11", features = ["const_generics"] } # for parsing nbt hematite-nbt = "0.5" @@ -107,13 +107,13 @@ tokio-tungstenite = "0.20.1" futures = "0.3" interfaces = { package = "swarmbot-interfaces", path = "interfaces", version = "0.1.2" } -anyhow = "1.0.68" -bincode = "2.0.0-alpha.2" -hex-literal = "0.3.4" +anyhow = "1.0.75" +bincode = "2.0.0-rc.3" +hex-literal = "0.4.1" cfb8 = "0.7" -tokio-stream = "0.1.11" +tokio-stream = "0.1.14" once_cell = { version = "1.18.0", features = ["parking_lot"] } -async-trait = "0.1.68" +async-trait = "0.1.74" tungstenite = "0.20.1" [dev-dependencies] diff --git a/interfaces/Cargo.toml b/interfaces/Cargo.toml index 736f707..8d51579 100644 --- a/interfaces/Cargo.toml +++ b/interfaces/Cargo.toml @@ -13,7 +13,7 @@ serde = { version = "1.0", features = ["derive"] } tokio-tungstenite = "0.20.1" tungstenite = "0.20.1" -tokio = { version = "1.24", features = [ +tokio = { version = "1.33", features = [ "rt", "io-std", "io-util", @@ -28,8 +28,8 @@ swarm-bot-packets = { path = "../packets", version = "0.2.0" } colored = "2.0" # chat parsing -regex = "1.5" +regex = "1.10" -itertools = "0.10.3" -num = "0.4.0" +itertools = "0.11.0" +num = "0.4.1" once_cell = { version = "1.18.0", features = ["parking_lot"] } diff --git a/packets/Cargo.toml b/packets/Cargo.toml index b29af77..b4bee31 100644 --- a/packets/Cargo.toml +++ b/packets/Cargo.toml @@ -8,6 +8,6 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bytes = "1.0" +bytes = "1.5" swarm-bot-packets-macro = { path = "packets_macro", version = "0.1.2" } # from a path in the local filesystem -tokio = { version = "1.24", features = ["full"] } +tokio = { version = "1.33", features = ["full"] } diff --git a/packets/packets_macro/Cargo.toml b/packets/packets_macro/Cargo.toml index 745611d..2a030d8 100644 --- a/packets/packets_macro/Cargo.toml +++ b/packets/packets_macro/Cargo.toml @@ -9,9 +9,9 @@ license = "GPL-2.0-or-later" [dependencies] -syn = { version = "1.0.57", features = ["full", "fold"] } -quote = "1.0.8" -proc-macro2 = "1.0.27" +syn = { version = "2.0.38", features = ["full", "fold"] } +quote = "1.0.33" +proc-macro2 = "1.0.69" [lib] proc-macro = true diff --git a/packets/packets_macro/src/lib.rs b/packets/packets_macro/src/lib.rs index fb2203f..4a03bc3 100644 --- a/packets/packets_macro/src/lib.rs +++ b/packets/packets_macro/src/lib.rs @@ -2,19 +2,17 @@ use proc_macro::TokenStream; use quote::quote; use syn::{ parse::{Parse, ParseStream}, - parse_macro_input, DeriveInput, ItemEnum, ItemStruct, Token, + parse_macro_input, DeriveInput, ItemEnum, ItemStruct, Meta, Token, }; -struct MyParams(syn::LitInt, syn::Ident); +struct PacketParams(syn::LitInt, syn::Ident); -impl Parse for MyParams { +impl Parse for PacketParams { fn parse(input: ParseStream) -> syn::Result { - let content; - syn::parenthesized!(content in input); - let type1 = content.parse()?; - content.parse::()?; - let type2 = content.parse()?; - Ok(MyParams(type1, type2)) + let type1 = input.parse()?; + input.parse::()?; + let type2 = input.parse()?; + Ok(PacketParams(type1, type2)) } } @@ -24,16 +22,22 @@ impl Parse for MyParams { pub fn packet(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); - let packe_attr = input + let packet_attr = input .attrs .iter() - .find(|attr| attr.path.is_ident("packet")) - .expect("need packet attibute"); + .find(|attr| attr.path().is_ident("packet")) + .expect("need packet attribute"); let name = input.ident; - let MyParams(id, kind) = - syn::parse(packe_attr.tokens.clone().into()).expect("Invalid attributes!"); + // let tokens = packet_attr.to_token_stream(); + let Meta::List(meta) = &packet_attr.meta else { + panic!("Invalid attributes!"); + }; + + let tokens = meta.tokens.clone(); + + let PacketParams(id, kind) = syn::parse(tokens.into()).expect("Invalid attributes!"); let expanded = quote! { diff --git a/src/bootstrap/storage.rs b/src/bootstrap/storage.rs index f13eb7a..fb1262f 100644 --- a/src/bootstrap/storage.rs +++ b/src/bootstrap/storage.rs @@ -215,7 +215,6 @@ impl UserCache { access_id: res.access_token, client_id: res.client_token, }; - let valid_user = valid_user; self.cache .insert(valid_user.email.clone(), User::Valid(valid_user.clone())); Some((mojang, proxy, valid_user)) diff --git a/src/client/commands.rs b/src/client/commands.rs index a73d91e..859512d 100644 --- a/src/client/commands.rs +++ b/src/client/commands.rs @@ -45,9 +45,13 @@ async fn command_receiver( Err(_e) => continue 'wloop, }; - let Value::Object(map) = &mut v else { bail!("invalid value") }; + let Value::Object(map) = &mut v else { + bail!("invalid value") + }; - let Value::String(path) = map.remove("path").expect("no path elem") else { bail!("invalid path") }; + let Value::String(path) = map.remove("path").expect("no path elem") else { + bail!("invalid path") + }; let command = process(&path, v).expect("invalid command"); tx.send(command).unwrap(); diff --git a/src/client/follow/mod.rs b/src/client/follow/mod.rs index f54553e..d5f1266 100644 --- a/src/client/follow/mod.rs +++ b/src/client/follow/mod.rs @@ -128,7 +128,9 @@ impl Follower { /// Generally paths will converge within maximally 3 or 4 blocks const ITERS_UNTIL_FAIL: usize = 100; - let Some(other) = Self::new(result) else { return }; + let Some(other) = Self::new(result) else { + return; + }; let on = self.xs.front(); diff --git a/src/client/pathfind/incremental/mod.rs b/src/client/pathfind/incremental/mod.rs index 1c8eec9..51b7173 100644 --- a/src/client/pathfind/incremental/mod.rs +++ b/src/client/pathfind/incremental/mod.rs @@ -94,8 +94,8 @@ struct AStarState { /// Takes ownership of all nodes and returns a path ending at `goal_idx` which /// will start at a starting idx determined by tracing `parent_map` -/// HashMap until there is no parent (i.e., the root node). This is the -/// most efficient path, so there should be no circles assuming non-negative +/// `HashMap` until there is no parent (i.e., the root node). This is +/// the most efficient path, so there should be no circles assuming non-negative /// weights. fn reconstruct_path( vec: &[T], @@ -245,7 +245,9 @@ impl AStar { ) -> Increment> { // obtain the state. If we have already finished the state is Option as we did // Option#take(..). We should not ever call this in that state. - let Some(state) = self.state.as_mut() else { panic!("called after finished") }; + let Some(state) = self.state.as_mut() else { + panic!("called after finished") + }; if let Some(node) = state.open_set.pop() { let parent = node.contents; @@ -260,7 +262,9 @@ impl AStar { return Increment::Finished(PathResult::complete(path)); } - let Progression::Movements(neighbors) = progressor.progressions(&parent) else { return Increment::InProgress }; + let Progression::Movements(neighbors) = progressor.progressions(&parent) else { + return Increment::InProgress; + }; let parent_record = parent.get_record(); let parent_record_idx = state.record_to_idx[&parent_record]; diff --git a/src/client/pathfind/mod.rs b/src/client/pathfind/mod.rs index 0c3a2ad..30711a4 100644 --- a/src/client/pathfind/mod.rs +++ b/src/client/pathfind/mod.rs @@ -33,13 +33,13 @@ impl Clone for MinHeapNode { impl Ord for MinHeapNode { fn cmp(&self, other: &Self) -> Ordering { - self.partial_cmp(other).unwrap_or(Ordering::Equal) + other.score.partial_cmp(&self.score).unwrap() } } impl PartialOrd for MinHeapNode { fn partial_cmp(&self, other: &Self) -> Option { - other.score.partial_cmp(&self.score) + Some(self.cmp(other)) } } diff --git a/src/client/runner.rs b/src/client/runner.rs index bc8c95e..68296e4 100644 --- a/src/client/runner.rs +++ b/src/client/runner.rs @@ -302,7 +302,6 @@ impl Runner { // Safety: // TODO let global_state = unsafe { global_state_sync.state() }; - let states_sync = states_sync; rayon::scope(|s| { for state_sync in states_sync { let (state, actions) = state_sync.0; diff --git a/src/client/tasks/lazy_stream.rs b/src/client/tasks/lazy_stream.rs index 1503c42..51c5ec2 100644 --- a/src/client/tasks/lazy_stream.rs +++ b/src/client/tasks/lazy_stream.rs @@ -58,7 +58,9 @@ impl TaskTrait for LazyStream { } fn expensive(&mut self, end_by: Instant, local: &mut LocalState, global: &GlobalState) { - let Some(current) = self.current.as_mut() else { return }; + let Some(current) = self.current.as_mut() else { + return; + }; current.expensive(end_by, local, global); } } diff --git a/src/client/tasks/navigate.rs b/src/client/tasks/navigate.rs index a4792dd..bb4e1fb 100644 --- a/src/client/tasks/navigate.rs +++ b/src/client/tasks/navigate.rs @@ -67,7 +67,9 @@ impl TaskTrait for Navig local: &mut LocalState, global: &mut GlobalState, ) -> bool { - let Some(follower) = self.follower.as_mut() else { return false }; + let Some(follower) = self.follower.as_mut() else { + return false; + }; if follower.should_recalc() { println!("recalc"); diff --git a/src/main.rs b/src/main.rs index 1ecbeb2..b296349 100644 --- a/src/main.rs +++ b/src/main.rs @@ -93,7 +93,7 @@ fn main() { local.block_on(&rt, async move { match run().await { // this should never happen as this should be an infinite loop - Ok(_) => println!("Program exited without errors somehow"), + Ok(()) => println!("Program exited without errors somehow"), // print the error in non-debug fashion Err(err) => println!("{err:?}"), diff --git a/src/protocol/io/reader.rs b/src/protocol/io/reader.rs index 588816a..f0ba3f8 100644 --- a/src/protocol/io/reader.rs +++ b/src/protocol/io/reader.rs @@ -34,7 +34,7 @@ impl AsyncRead for EncryptedReader { buf: &mut ReadBuf<'_>, ) -> Poll> { let filled_before = buf.filled().len(); - Pin::new(&mut self.reader).poll_read(cx, buf).map_ok(|_| { + Pin::new(&mut self.reader).poll_read(cx, buf).map_ok(|()| { let filled_after = buf.filled().len(); let to_encrypt = &mut buf.filled_mut()[filled_before..filled_after]; diff --git a/src/storage/blocks.rs b/src/storage/blocks.rs index 5d602a3..827ff83 100644 --- a/src/storage/blocks.rs +++ b/src/storage/blocks.rs @@ -176,9 +176,6 @@ impl WorldBlocks { let x = (x - (chunk_x << 4)) as u8; let z = (z - (chunk_z << 4)) as u8; - let chunk_x = chunk_x; - let chunk_z = chunk_z; - let loc = ChunkLocation(chunk_x, chunk_z); let column = self.storage.get(&loc)?; @@ -294,9 +291,6 @@ impl WorldBlocks { let x = (x - (chunk_x << 4)) as u8; let z = (z - (chunk_z << 4)) as u8; - let chunk_x = chunk_x; - let chunk_z = chunk_z; - let loc = ChunkLocation(chunk_x, chunk_z); let column = self.storage.entry(loc).or_default(); diff --git a/src/storage/chunk.rs b/src/storage/chunk.rs index aee6dc9..c5bcf4b 100644 --- a/src/storage/chunk.rs +++ b/src/storage/chunk.rs @@ -132,7 +132,9 @@ impl ChunkData { let chunk_y = y - (section_idx << 4); let mut res = [BlockState::AIR; 16 * 16]; - let Some(section) = self.sections[section_idx as usize].as_ref() else { return res }; + let Some(section) = self.sections[section_idx as usize].as_ref() else { + return res; + }; let mut idx = 0; diff --git a/src/storage/entities.rs b/src/storage/entities.rs index 00d2c4d..340fe77 100644 --- a/src/storage/entities.rs +++ b/src/storage/entities.rs @@ -21,7 +21,9 @@ pub struct WorldEntities { impl WorldEntities { pub fn update_entity(&mut self, entity_id: u32, bot_id: u32, location: LocationOrigin) { - let Some(entity) = self.entities.get_mut(&entity_id) else { return }; + let Some(entity) = self.entities.get_mut(&entity_id) else { + return; + }; let id = entity.owner.get_or_insert(bot_id); if *id == bot_id { entity.location.apply_change(location); diff --git a/swarmbot-cli/Cargo.toml b/swarmbot-cli/Cargo.toml index a5adfd3..4d91962 100644 --- a/swarmbot-cli/Cargo.toml +++ b/swarmbot-cli/Cargo.toml @@ -7,10 +7,10 @@ edition = "2021" [dependencies] swarmbot-interfaces = { path = "../interfaces" } -clap = { version = "4.1.1" , features = ["derive"]} +clap = { version = "4.4.6" , features = ["derive"]} serde = "1.0" tokio-tungstenite = "0.20.1" -tokio = { version = "1.24.1" , features = ["full"] } +tokio = { version = "1.33.0" , features = ["full"] } anyhow = "1.0" futures = "0.3" serde_json = "1.0"