update dependencies and follow more clippy advices
This commit is contained in:
parent
0c26ed24de
commit
07068a0150
8 changed files with 352 additions and 165 deletions
372
Cargo.lock
generated
372
Cargo.lock
generated
|
@ -55,15 +55,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.5.0"
|
||||
version = "0.6.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c"
|
||||
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
|
@ -93,14 +94,20 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "2.1.0"
|
||||
version = "3.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd"
|
||||
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
|
@ -124,9 +131,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.3"
|
||||
version = "0.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53"
|
||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
|
@ -190,23 +197,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.31"
|
||||
version = "0.4.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-targets 0.48.5",
|
||||
"windows-targets 0.52.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.4.2"
|
||||
version = "4.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6"
|
||||
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
|
@ -214,9 +221,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.4.2"
|
||||
version = "4.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08"
|
||||
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
|
@ -226,9 +233,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.4.2"
|
||||
version = "4.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
|
||||
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
|
@ -238,9 +245,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.5.1"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961"
|
||||
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
|
@ -360,6 +367,12 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[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"
|
||||
|
@ -503,15 +516,15 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
|||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.21"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833"
|
||||
checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes",
|
||||
"fnv",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"http",
|
||||
"indexmap",
|
||||
"slab",
|
||||
|
@ -522,15 +535,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
|
@ -554,9 +567,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.9"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
|
||||
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
|
@ -565,12 +578,24 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "0.4.5"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
|
||||
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body-util"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"http",
|
||||
"http-body",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
|
@ -580,47 +605,60 @@ version = "1.8.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||
|
||||
[[package]]
|
||||
name = "httpdate"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.27"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468"
|
||||
checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"httparse",
|
||||
"httpdate",
|
||||
"itoa",
|
||||
"pin-project-lite",
|
||||
"socket2 0.4.9",
|
||||
"smallvec",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-tls"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
|
||||
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"native-tls",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -664,11 +702,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
version = "2.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
|
@ -678,6 +716,12 @@ version = "2.8.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6"
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.9"
|
||||
|
@ -833,9 +877,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.18.0"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
|
@ -990,6 +1034,26 @@ dependencies = [
|
|||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
|
@ -1022,9 +1086,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.66"
|
||||
version = "1.0.84"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||
checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -1108,9 +1172,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
|||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.11.20"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
|
||||
checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
|
@ -1120,8 +1184,10 @@ dependencies = [
|
|||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-tls",
|
||||
"hyper-util",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
"log",
|
||||
|
@ -1130,9 +1196,12 @@ dependencies = [
|
|||
"once_cell",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustls-pemfile",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
|
@ -1162,6 +1231,22 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "2.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.15"
|
||||
|
@ -1185,9 +1270,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
|||
|
||||
[[package]]
|
||||
name = "scraper"
|
||||
version = "0.18.1"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "585480e3719b311b78a573db1c9d9c4c1f8010c2dee4cc59c2efe58ea4dbc3e1"
|
||||
checksum = "5b80b33679ff7a0ea53d37f3b39de77ea0c75b12c5805ac43ec0c33b3051af1b"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"cssparser",
|
||||
|
@ -1325,19 +1410,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.11.0"
|
||||
version = "1.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
|
@ -1383,9 +1458,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
|
@ -1409,6 +1484,33 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"system-configuration-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration-sys"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.8.0"
|
||||
|
@ -1470,9 +1572,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.35.1"
|
||||
version = "1.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
|
||||
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
|
@ -1482,7 +1584,7 @@ dependencies = [
|
|||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2 0.5.5",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
@ -1522,6 +1624,27 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-layer"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
|
||||
|
||||
[[package]]
|
||||
name = "tower-service"
|
||||
version = "0.3.2"
|
||||
|
@ -1606,9 +1729,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
|||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.6.1"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
|
||||
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"rand",
|
||||
|
@ -1717,28 +1840,6 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.48.0"
|
||||
|
@ -1766,6 +1867,15 @@ dependencies = [
|
|||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.2"
|
||||
|
@ -1796,6 +1906,22 @@ dependencies = [
|
|||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.5",
|
||||
"windows_aarch64_msvc 0.52.5",
|
||||
"windows_i686_gnu 0.52.5",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.52.5",
|
||||
"windows_x86_64_gnu 0.52.5",
|
||||
"windows_x86_64_gnullvm 0.52.5",
|
||||
"windows_x86_64_msvc 0.52.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.2"
|
||||
|
@ -1808,6 +1934,12 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.2"
|
||||
|
@ -1820,6 +1952,12 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.2"
|
||||
|
@ -1832,6 +1970,18 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.2"
|
||||
|
@ -1844,6 +1994,12 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.2"
|
||||
|
@ -1856,6 +2012,12 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.2"
|
||||
|
@ -1868,6 +2030,12 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.2"
|
||||
|
@ -1881,10 +2049,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.50.0"
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
|
||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-sys 0.48.0",
|
||||
|
|
20
Cargo.toml
20
Cargo.toml
|
@ -11,12 +11,20 @@ publish = false
|
|||
license = "AGPL-3.0-or-later"
|
||||
|
||||
[dependencies]
|
||||
reqwest = { version = "0.11" }
|
||||
tokio = { version = "1.35", features = ["full"] }
|
||||
scraper = "0.18"
|
||||
reqwest = { version = "0.12" }
|
||||
tokio = { version = "1.37", features = ["full"] }
|
||||
scraper = "0.19"
|
||||
regex = "1.10"
|
||||
chrono = "0.4.31"
|
||||
chrono = "0.4.38"
|
||||
ics = { version = "0.5", default-features = false }
|
||||
uuid = { version = "1.6", features = ["v4", "fast-rng"] }
|
||||
clap = { version = "4.4", features = ["derive"] }
|
||||
uuid = { version = "1.8", features = ["v4", "fast-rng"] }
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
dialoguer = "0.11"
|
||||
|
||||
[lints.clippy]
|
||||
correctness = "warn"
|
||||
suspicious = "warn"
|
||||
complexity = "warn"
|
||||
perf = "warn"
|
||||
style = "warn"
|
||||
pedantic = "warn"
|
||||
|
|
|
@ -34,15 +34,15 @@ fn choice(timetable: &mut Timetable) {
|
|||
day.courses.iter().for_each(|course_opt| {
|
||||
if let Some(course) = course_opt {
|
||||
if !multiselected.contains(&course.name) {
|
||||
multiselected.push(course.name.to_owned());
|
||||
multiselected.push(course.name.clone());
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
let defaults = vec![true; multiselected.len()];
|
||||
let selections = MultiSelect::new()
|
||||
.with_prompt(format!("Choisis tes matières {}", DISCLAIMER))
|
||||
.with_prompt(format!("Choisis tes matières {DISCLAIMER}"))
|
||||
.items(&multiselected[..])
|
||||
.defaults(&defaults[..])
|
||||
.interact()
|
||||
|
@ -82,7 +82,7 @@ fn courses(timetable: &mut Timetable) {
|
|||
if !multiselected.is_empty() {
|
||||
let defaults = vec![false; multiselected.len()];
|
||||
selections = MultiSelect::new()
|
||||
.with_prompt(format!("Choisis tes horaires de Cours {}", DISCLAIMER))
|
||||
.with_prompt(format!("Choisis tes horaires de Cours {DISCLAIMER}"))
|
||||
.items(&multiselected[..])
|
||||
.defaults(&defaults[..])
|
||||
.interact()
|
||||
|
@ -107,7 +107,7 @@ fn courses(timetable: &mut Timetable) {
|
|||
|
||||
// Keep only chosen courses if multiple was available
|
||||
for i in &selections {
|
||||
if get_selection(&(course, day.name.to_owned())) == multiselected[*i] {
|
||||
if get_selection(&(course, day.name.clone())) == multiselected[*i] {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ fn tdtp(timetable: &mut Timetable, merge: bool) {
|
|||
if !multiselected.is_empty() {
|
||||
let defaults = vec![false; multiselected.len()];
|
||||
selections = MultiSelect::new()
|
||||
.with_prompt(format!("Choisis tes horaires de TD/TP {}", DISCLAIMER))
|
||||
.with_prompt(format!("Choisis tes horaires de TD/TP {DISCLAIMER}"))
|
||||
.items(&multiselected[..])
|
||||
.defaults(&defaults[..])
|
||||
.interact()
|
||||
|
@ -160,7 +160,7 @@ fn tdtp(timetable: &mut Timetable, merge: bool) {
|
|||
|
||||
// Keep only chosen TD/TP if multiple was available
|
||||
for i in &selections {
|
||||
if get_selection(&(course, day.name.to_owned())) == multiselected[*i] {
|
||||
if get_selection(&(course, day.name.clone())) == multiselected[*i] {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut Str
|
|||
let categories = course
|
||||
.category
|
||||
.iter()
|
||||
.map(|c| c.to_string())
|
||||
.map(std::string::ToString::to_string)
|
||||
.collect::<Arc<[String]>>()
|
||||
.join("/");
|
||||
|
||||
|
@ -86,8 +86,11 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut Str
|
|||
}
|
||||
|
||||
// Add the extension if needed
|
||||
if !filename.ends_with(".ics") {
|
||||
*filename = format!("{}.ics", filename)
|
||||
if !std::path::Path::new(filename)
|
||||
.extension()
|
||||
.map_or(false, |ext| ext.eq_ignore_ascii_case("ics"))
|
||||
{
|
||||
*filename = format!("{filename}.ics");
|
||||
};
|
||||
|
||||
calendar.save_file(filename).unwrap();
|
||||
|
|
|
@ -104,7 +104,7 @@ fn anglophonization(date: &str) -> String {
|
|||
// New regex of all the french month
|
||||
let re = Regex::new(&format!(
|
||||
"({})",
|
||||
dico.keys().cloned().collect::<Arc<[_]>>().join("|")
|
||||
dico.keys().copied().collect::<Arc<[_]>>().join("|")
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
|
@ -115,13 +115,13 @@ fn anglophonization(date: &str) -> String {
|
|||
re.replace_all(date, |cap: &Captures| match &cap[0] {
|
||||
month if dico.contains_key(month) => dico.get(month).unwrap(),
|
||||
month => {
|
||||
panic!("Unknown month: {}", month)
|
||||
panic!("Unknown month: {month}")
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
/// Turn a string to a DateTime
|
||||
/// Turn a string to a `DateTime`
|
||||
fn get_date(date: &str) -> DateTime<Utc> {
|
||||
// Use and keep UTC time, we have the hour set to 12h and
|
||||
// Paris 7 is in France so there is no problems
|
||||
|
|
|
@ -53,7 +53,7 @@ async fn main() {
|
|||
|
||||
let user_agent = format!("cal7tor/{}", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
println!("Récupération de l'emploi du temps des M{}...", level,);
|
||||
println!("Récupération de l'emploi du temps des M{level}...");
|
||||
let mut timetable = timetable::timetable(level, args.semester, args.year, &user_agent).await;
|
||||
|
||||
timetable = filter::timetable(timetable, args.td_are_tp);
|
||||
|
@ -65,15 +65,15 @@ async fn main() {
|
|||
// Export the calendar
|
||||
let mut filename = args.export.unwrap();
|
||||
|
||||
let builded_timetable = timetable::build(timetable, info);
|
||||
let builded_timetable = timetable::build(&timetable, &info);
|
||||
ics::export(builded_timetable, &mut filename);
|
||||
|
||||
println!("Fichier .ICS construit et exporté => {}", filename);
|
||||
println!("Fichier .ICS construit et exporté => {filename}");
|
||||
} else {
|
||||
println!("\x1b[93mNOTICE: IT WON'T WORK!!!\x1b[0m");
|
||||
// Show the calendar
|
||||
println!("Affichage...");
|
||||
timetable::display(timetable, args.cl);
|
||||
timetable::display(&timetable, args.cl);
|
||||
println!("Vous devrez peut-être mettre votre terminal en plein écran si ce n'est pas déjà le cas.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::cast_sign_loss)]
|
||||
|
||||
use chrono::{Datelike, Duration, TimeZone, Utc};
|
||||
use regex::Regex;
|
||||
use scraper::Selector;
|
||||
|
@ -111,7 +113,7 @@ pub async fn timetable(
|
|||
} else {
|
||||
// Day with the name doesn't exist, create a new Day
|
||||
timetable.push(models::Day {
|
||||
name: day.to_owned(),
|
||||
name: day.clone(),
|
||||
courses: vec![Some(course)],
|
||||
});
|
||||
}
|
||||
|
@ -129,7 +131,7 @@ pub async fn timetable(
|
|||
}
|
||||
|
||||
/// Build the timetable
|
||||
pub fn build(timetable: models::Timetable, dates: Info) -> Vec<models::Course> {
|
||||
pub fn build(timetable: &models::Timetable, dates: &Info) -> Vec<models::Course> {
|
||||
let mut schedules = Vec::new();
|
||||
// h1 => heure de début | m1 => minute de début
|
||||
// h2 => heure de fin | m2 => minute de fin
|
||||
|
@ -166,16 +168,16 @@ pub fn build(timetable: models::Timetable, dates: Info) -> Vec<models::Course> {
|
|||
&schedules,
|
||||
&timetable.1 .1,
|
||||
&datetimes.course,
|
||||
Some(vec![models::Category::Cours]),
|
||||
None,
|
||||
&Some(vec![models::Category::Cours]),
|
||||
&None,
|
||||
);
|
||||
add_courses(
|
||||
&mut semester,
|
||||
&schedules,
|
||||
&timetable.1 .1,
|
||||
&datetimes.td_tp,
|
||||
None,
|
||||
Some(vec![models::Category::Cours]),
|
||||
&None,
|
||||
&Some(vec![models::Category::Cours]),
|
||||
);
|
||||
|
||||
semester
|
||||
|
@ -194,9 +196,9 @@ fn add_courses(
|
|||
// Current courses list
|
||||
info: &InfoList,
|
||||
// List of category allowed
|
||||
keep: Option<Vec<models::Category>>,
|
||||
keep: &Option<Vec<models::Category>>,
|
||||
// List of category excluded
|
||||
exclude: Option<Vec<models::Category>>,
|
||||
exclude: &Option<Vec<models::Category>>,
|
||||
) {
|
||||
let before_break = info.first().unwrap();
|
||||
let mut date = before_break.0;
|
||||
|
@ -213,9 +215,9 @@ fn add_courses(
|
|||
|
||||
// Check keep and exclude filters
|
||||
if keep
|
||||
.to_owned()
|
||||
.clone()
|
||||
.is_some_and(|list| !course.category.iter().any(|item| list.contains(item)))
|
||||
|| exclude.to_owned().is_some_and(|list| {
|
||||
|| exclude.clone().is_some_and(|list| {
|
||||
course.category.iter().any(|item| list.contains(item))
|
||||
})
|
||||
{
|
||||
|
@ -260,7 +262,7 @@ fn add_courses(
|
|||
}
|
||||
|
||||
/// Display the timetable
|
||||
pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_length: usize) {
|
||||
pub fn display(timetable: &(Arc<[String]>, (usize, Vec<models::Day>)), cell_length: usize) {
|
||||
// Cell length for hours
|
||||
let clh = 11;
|
||||
// Cell number
|
||||
|
@ -271,7 +273,7 @@ pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_lengt
|
|||
let sep = TabChar::Bv.val();
|
||||
|
||||
// Top of the tab
|
||||
utils::line_table(clh, cell_length, cn, Position::Top, HashMap::new());
|
||||
utils::line_table(clh, cell_length, cn, &Position::Top, &HashMap::new());
|
||||
|
||||
// First empty case
|
||||
print!("{}{:^clh$}{}", sep, "", sep);
|
||||
|
@ -288,13 +290,13 @@ pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_lengt
|
|||
// For each hours -- i the hour's number
|
||||
for (i, hour) in timetable.0.iter().enumerate() {
|
||||
// Draw separator line
|
||||
utils::line_table(clh, cell_length, cn, Position::Middle, next_skip);
|
||||
utils::line_table(clh, cell_length, cn, &Position::Middle, &next_skip);
|
||||
|
||||
// Reset
|
||||
next_skip = HashMap::new();
|
||||
|
||||
// Print hour
|
||||
print!("{}{:^clh$}", sep, hour);
|
||||
print!("{sep}{hour:^clh$}");
|
||||
|
||||
// For all the days - `j` the day's number
|
||||
for (j, day) in timetable.1 .1.iter().enumerate() {
|
||||
|
@ -321,7 +323,8 @@ pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_lengt
|
|||
}
|
||||
info_slot = true;
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
|
||||
// Else simply print the course
|
||||
// If the data is too long
|
||||
if course.name.len() > quarter {
|
||||
|
@ -333,7 +336,6 @@ pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_lengt
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If no course was found
|
||||
None => {
|
||||
// Verify the "no course" is in the correct day and hour
|
||||
|
@ -353,8 +355,8 @@ pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_lengt
|
|||
print!("{}{:^cell_length$}", sep, "");
|
||||
}
|
||||
}
|
||||
print!("{}", sep);
|
||||
print!("{sep}");
|
||||
}
|
||||
// Bottom of the table
|
||||
utils::line_table(clh, cell_length, cn, Position::Bottom, HashMap::new());
|
||||
utils::line_table(clh, cell_length, cn, &Position::Bottom, &HashMap::new());
|
||||
}
|
||||
|
|
34
src/utils.rs
34
src/utils.rs
|
@ -11,7 +11,7 @@ pub mod models;
|
|||
pub fn check_errors(html: &String, loc: &str) {
|
||||
let no_timetable = "Aucun créneau horaire affecté";
|
||||
match html {
|
||||
t if t.contains(no_timetable) => panic!("URL: {} • {}", loc, no_timetable),
|
||||
t if t.contains(no_timetable) => panic!("URL: {loc} • {no_timetable}"),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ pub fn line_table(
|
|||
cell_length_hours: usize,
|
||||
cell_length: usize,
|
||||
number_cell: usize,
|
||||
pos: models::Position,
|
||||
skip_with: std::collections::HashMap<usize, &str>,
|
||||
pos: &models::Position,
|
||||
skip_with: &std::collections::HashMap<usize, &str>,
|
||||
) {
|
||||
// Left side
|
||||
let ls = match pos {
|
||||
|
@ -60,8 +60,8 @@ pub fn line_table(
|
|||
|
||||
// Hours column
|
||||
match skip_with.get(&0) {
|
||||
Some(_) => print!("\n{}{}{}", ls, line_h, rs_bbc),
|
||||
None => print!("\n{}{}{}", ls, line_h, ms),
|
||||
Some(_) => print!("\n{ls}{line_h}{rs_bbc}"),
|
||||
None => print!("\n{ls}{line_h}{ms}"),
|
||||
};
|
||||
|
||||
// Courses columns
|
||||
|
@ -72,26 +72,26 @@ pub fn line_table(
|
|||
if i == range - 1 {
|
||||
// Friday only
|
||||
if let Some(text) = skip_with.get(&i) {
|
||||
println!("{:^cell_length$}{}", text, rsbc_bbc);
|
||||
println!("{text:^cell_length$}{rsbc_bbc}");
|
||||
last_day = true;
|
||||
}
|
||||
} else {
|
||||
match skip_with.get(&i) {
|
||||
Some(text) => match skip_with.get(&(i + 1)) {
|
||||
// Match check if the next cell will be big
|
||||
Some(_) => print!("{:^cell_length$}{}", text, rsbc_bbc),
|
||||
None => print!("{:^cell_length$}{}", text, rsbc),
|
||||
Some(_) => print!("{text:^cell_length$}{rsbc_bbc}"),
|
||||
None => print!("{text:^cell_length$}{rsbc}"),
|
||||
},
|
||||
None => match skip_with.get(&(i + 1)) {
|
||||
// Match check if the next cell will be big
|
||||
Some(_) => print!("{}{}", line, rs_bbc),
|
||||
None => print!("{}{}", line, ms),
|
||||
Some(_) => print!("{line}{rs_bbc}"),
|
||||
None => print!("{line}{ms}"),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
if !last_day {
|
||||
println!("{}{}", line, rs);
|
||||
println!("{line}{rs}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ pub async fn get_webpage(
|
|||
year: &str,
|
||||
user_agent: &str,
|
||||
) -> Result<Html, Box<dyn std::error::Error>> {
|
||||
let url = format!("https://silice.informatique.univ-paris-diderot.fr/ufr/U{}/EDT/visualiserEmploiDuTemps.php?quoi=M{},{}", year, level, semester);
|
||||
let url = format!("https://silice.informatique.univ-paris-diderot.fr/ufr/U{year}/EDT/visualiserEmploiDuTemps.php?quoi=M{level},{semester}");
|
||||
|
||||
// Use custom User-Agent
|
||||
let client = reqwest::Client::builder().user_agent(user_agent).build()?;
|
||||
|
@ -189,9 +189,9 @@ pub fn get_hours() -> Arc<[String]> {
|
|||
let mut hours = vec![];
|
||||
for hour in 8..=20 {
|
||||
for minute in &[0, 15, 30, 45] {
|
||||
let hour_str = format!("{}h{:02}", hour, minute);
|
||||
let hour_str = format!("{hour}h{minute:02}");
|
||||
if let Some(last_hour) = hours.pop() {
|
||||
hours.push(format!("{}-{}", last_hour, hour_str));
|
||||
hours.push(format!("{last_hour}-{hour_str}"));
|
||||
}
|
||||
hours.push(hour_str);
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ pub fn get_entry(course: &Course) -> String {
|
|||
|
||||
/// Entry's name used for finding duplicates, ignoring categories
|
||||
pub fn get_entry_nocat(course: &Course) -> String {
|
||||
course.name.to_owned()
|
||||
course.name.clone()
|
||||
}
|
||||
|
||||
/// Returns a couple of (list of courses) and (a hashmap of how much they appears in the vector)
|
||||
|
@ -247,12 +247,12 @@ pub fn get_count<'a>(
|
|||
.iter()
|
||||
.any(|category| allowed_list.contains(category))
|
||||
{
|
||||
courses.push((course, day.name.to_owned()));
|
||||
courses.push((course, day.name.clone()));
|
||||
let count = counts.entry(getter(course)).or_insert(0);
|
||||
*count += 1;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
(courses, counts)
|
||||
|
|
Reference in a new issue