[INFO] cloning repository https://github.com/lijunyi/gemini [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/lijunyi/gemini" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Flijunyi%2Fgemini", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Flijunyi%2Fgemini'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 5c28cbb1c060697eda41c4c33b79954dbd26305b [INFO] linting lijunyi/gemini against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Flijunyi%2Fgemini" "/workspace/builds/worker-4-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-4-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/lijunyi/gemini [INFO] finished tweaking git repo https://github.com/lijunyi/gemini [INFO] tweaked toml for git repo https://github.com/lijunyi/gemini written to /workspace/builds/worker-4-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/lijunyi/gemini on toolchain nightly [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "metadata" "--manifest-path" "Cargo.toml" "--no-deps", kill_on_drop: false }` [INFO] crate git repo https://github.com/lijunyi/gemini already has a lockfile, it will not be regenerated [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] [stderr] Updating crates.io index [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] [stderr] Downloading crates ... [INFO] [stderr] Downloaded tower-sessions-core v0.12.3 [INFO] [stderr] Downloaded rust-embed-utils v8.9.0 [INFO] [stderr] Downloaded tower-sessions-memory-store v0.12.3 [INFO] [stderr] Downloaded rust-embed-impl v8.9.0 [INFO] [stderr] Downloaded include-flate v0.3.1 [INFO] [stderr] Downloaded tower-cookies v0.10.0 [INFO] [stderr] Downloaded include-flate-compress v0.3.1 [INFO] [stderr] Downloaded include-flate-codegen v0.3.1 [INFO] [stderr] Downloaded libflate_lz77 v2.2.0 [INFO] [stderr] Downloaded tower-sessions v0.12.3 [INFO] [stderr] Downloaded axum-extra v0.9.6 [INFO] [stderr] Downloaded rle-decode-fast v1.0.3 [INFO] [stderr] Downloaded cc v1.2.46 [INFO] [stderr] Downloaded libflate v2.2.1 [INFO] [stderr] Downloaded rust-embed v8.9.0 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] 279b6c2196afa86b30af272bf555cb7c5825529e267d41e579ab1aeb86cf1526 [INFO] running `Command { std: "docker" "start" "-a" "279b6c2196afa86b30af272bf555cb7c5825529e267d41e579ab1aeb86cf1526", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "279b6c2196afa86b30af272bf555cb7c5825529e267d41e579ab1aeb86cf1526", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "279b6c2196afa86b30af272bf555cb7c5825529e267d41e579ab1aeb86cf1526", kill_on_drop: false }` [INFO] [stdout] 279b6c2196afa86b30af272bf555cb7c5825529e267d41e579ab1aeb86cf1526 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "clippy" "--frozen" "--all" "--all-targets" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 4576744f2d0412b35a48f52fc8f3cc47054c86c42e29e68357d4a9a95091b9ea [INFO] running `Command { std: "docker" "start" "-a" "4576744f2d0412b35a48f52fc8f3cc47054c86c42e29e68357d4a9a95091b9ea", kill_on_drop: false }` [INFO] [stderr] Compiling proc-macro2 v1.0.103 [INFO] [stderr] Compiling quote v1.0.42 [INFO] [stderr] Compiling libc v0.2.177 [INFO] [stderr] Checking log v0.4.28 [INFO] [stderr] Compiling zerocopy v0.8.27 [INFO] [stderr] Checking tracing-core v0.1.34 [INFO] [stderr] Compiling icu_properties_data v2.1.1 [INFO] [stderr] Compiling stable_deref_trait v1.2.1 [INFO] [stderr] Checking foldhash v0.2.0 [INFO] [stderr] Compiling memchr v2.7.6 [INFO] [stderr] Compiling serde_json v1.0.145 [INFO] [stderr] Checking http v1.3.1 [INFO] [stderr] Compiling ahash v0.8.12 [INFO] [stderr] Compiling allocator-api2 v0.2.21 [INFO] [stderr] Compiling num-traits v0.2.19 [INFO] [stderr] Compiling typenum v1.19.0 [INFO] [stderr] Compiling litemap v0.8.1 [INFO] [stderr] Checking hashbrown v0.16.0 [INFO] [stderr] Compiling crossbeam-utils v0.8.21 [INFO] [stderr] Compiling writeable v0.6.2 [INFO] [stderr] Compiling smallvec v1.15.1 [INFO] [stderr] Compiling futures-core v0.3.31 [INFO] [stderr] Compiling crc32fast v1.5.0 [INFO] [stderr] Compiling pin-project-lite v0.2.16 [INFO] [stderr] Compiling lock_api v0.4.14 [INFO] [stderr] Compiling icu_normalizer_data v2.1.1 [INFO] [stderr] Compiling futures-sink v0.3.31 [INFO] [stderr] Compiling untrusted v0.9.0 [INFO] [stderr] Compiling syn v1.0.109 [INFO] [stderr] Compiling generic-array v0.14.7 [INFO] [stderr] Checking indexmap v2.12.0 [INFO] [stderr] Compiling serde_core v1.0.228 [INFO] [stderr] Compiling rustls v0.21.12 [INFO] [stderr] Compiling time-core v0.1.6 [INFO] [stderr] Checking sync_wrapper v1.0.2 [INFO] [stderr] Checking deranged v0.5.5 [INFO] [stderr] Compiling time-macros v0.2.24 [INFO] [stderr] Compiling block-buffer v0.10.4 [INFO] [stderr] Compiling crypto-common v0.1.7 [INFO] [stderr] Checking http-body v1.0.1 [INFO] [stderr] Compiling syn v2.0.110 [INFO] [stderr] Compiling digest v0.10.7 [INFO] [stderr] Compiling futures-task v0.3.31 [INFO] [stderr] Compiling slab v0.4.11 [INFO] [stderr] Compiling bytes v1.11.0 [INFO] [stderr] Checking http-body-util v0.1.3 [INFO] [stderr] Checking parking_lot_core v0.9.12 [INFO] [stderr] Checking mio v1.1.0 [INFO] [stderr] Checking signal-hook-registry v1.4.6 [INFO] [stderr] Checking socket2 v0.6.1 [INFO] [stderr] Checking getrandom v0.2.16 [INFO] [stderr] Compiling sha2 v0.10.9 [INFO] [stderr] Checking getrandom v0.3.4 [INFO] [stderr] Compiling futures-io v0.3.31 [INFO] [stderr] Checking rand_core v0.6.4 [INFO] [stderr] Compiling jobserver v0.1.34 [INFO] [stderr] Compiling utf8_iter v1.0.4 [INFO] [stderr] Compiling cc v1.2.46 [INFO] [stderr] Compiling futures-util v0.3.31 [INFO] [stderr] Compiling parking_lot v0.12.5 [INFO] [stderr] Compiling nom v7.1.3 [INFO] [stderr] Compiling form_urlencoded v1.2.2 [INFO] [stderr] Compiling core2 v0.4.0 [INFO] [stderr] Compiling tokio v1.48.0 [INFO] [stderr] Checking http v0.2.12 [INFO] [stderr] Compiling base64 v0.21.7 [INFO] [stderr] Compiling rle-decode-fast v1.0.3 [INFO] [stderr] Compiling ryu v1.0.20 [INFO] [stderr] Compiling itoa v1.0.15 [INFO] [stderr] Compiling iana-time-zone v0.1.64 [INFO] [stderr] Compiling rustix v1.1.2 [INFO] [stderr] Checking bitflags v2.10.0 [INFO] [stderr] Compiling chrono v0.4.42 [INFO] [stderr] Compiling rustls-pemfile v1.0.4 [INFO] [stderr] Compiling libflate_lz77 v2.2.0 [INFO] [stderr] Compiling crossbeam-queue v0.3.12 [INFO] [stderr] Compiling crc v3.3.0 [INFO] [stderr] Compiling futures-intrusive v0.5.0 [INFO] [stderr] Checking ppv-lite86 v0.2.21 [INFO] [stderr] Compiling atoi v2.0.0 [INFO] [stderr] Compiling spin v0.9.8 [INFO] [stderr] Checking hashbrown v0.14.5 [INFO] [stderr] Compiling futures-channel v0.3.31 [INFO] [stderr] Compiling cookie v0.18.1 [INFO] [stderr] Compiling adler32 v1.2.0 [INFO] [stderr] Compiling uuid v1.18.1 [INFO] [stderr] Compiling linux-raw-sys v0.11.0 [INFO] [stderr] Compiling webpki-roots v0.25.4 [INFO] [stderr] Compiling dary_heap v0.3.8 [INFO] [stderr] Compiling native-tls v0.2.14 [INFO] [stderr] Compiling event-listener v2.5.3 [INFO] [stderr] Compiling libflate v2.2.1 [INFO] [stderr] Compiling sqlformat v0.2.6 [INFO] [stderr] Compiling flume v0.11.1 [INFO] [stderr] Checking rand_chacha v0.3.1 [INFO] [stderr] Checking http-body v0.4.6 [INFO] [stderr] Compiling proc-macro-error-attr v1.0.4 [INFO] [stderr] Compiling hashlink v0.8.4 [INFO] [stderr] Checking socket2 v0.5.10 [INFO] [stderr] Compiling ring v0.17.14 [INFO] [stderr] Compiling zstd-sys v2.0.16+zstd.1.5.7 [INFO] [stderr] Compiling openssl-sys v0.9.111 [INFO] [stderr] Compiling libsqlite3-sys v0.27.0 [INFO] [stderr] Compiling urlencoding v2.1.3 [INFO] [stderr] Compiling futures-executor v0.3.31 [INFO] [stderr] Compiling unicase v2.8.1 [INFO] [stderr] Compiling fastrand v2.3.0 [INFO] [stderr] Compiling heck v0.4.1 [INFO] [stderr] Compiling mime_guess v2.0.5 [INFO] [stderr] Compiling proc-macro-error v1.0.4 [INFO] [stderr] Checking rand v0.8.5 [INFO] [stderr] Compiling openssl v0.10.75 [INFO] [stderr] Compiling multer v3.1.0 [INFO] [stderr] Checking regex-syntax v0.8.8 [INFO] [stderr] Compiling rust-embed-utils v8.9.0 [INFO] [stderr] Checking headers-core v0.3.0 [INFO] [stderr] Checking serde_path_to_error v0.1.20 [INFO] [stderr] Checking winnow v0.7.13 [INFO] [stderr] Checking clap_lex v0.7.6 [INFO] [stderr] Checking base64ct v1.8.0 [INFO] [stderr] Checking headers v0.4.1 [INFO] [stderr] Checking clap_builder v4.5.53 [INFO] [stderr] Checking tracing-log v0.2.0 [INFO] [stderr] Checking blake2 v0.10.6 [INFO] [stderr] Checking regex-automata v0.4.13 [INFO] [stderr] Checking password-hash v0.5.0 [INFO] [stderr] Compiling synstructure v0.13.2 [INFO] [stderr] Checking http-range-header v0.4.2 [INFO] [stderr] Checking argon2 v0.5.3 [INFO] [stderr] Compiling tempfile v3.23.0 [INFO] [stderr] Compiling serde_derive v1.0.228 [INFO] [stderr] Compiling zerofrom-derive v0.1.6 [INFO] [stderr] Compiling yoke-derive v0.8.1 [INFO] [stderr] Compiling zerovec-derive v0.11.2 [INFO] [stderr] Compiling displaydoc v0.2.5 [INFO] [stderr] Compiling tracing-attributes v0.1.30 [INFO] [stderr] Compiling tokio-macros v2.6.0 [INFO] [stderr] Compiling futures-macro v0.3.31 [INFO] [stderr] Compiling thiserror-impl v1.0.69 [INFO] [stderr] Checking sct v0.7.1 [INFO] [stderr] Checking rustls-webpki v0.101.7 [INFO] [stderr] Compiling zerofrom v0.1.6 [INFO] [stderr] Compiling async-trait v0.1.89 [INFO] [stderr] Compiling yoke v0.8.1 [INFO] [stderr] Compiling tokio-stream v0.1.17 [INFO] [stderr] Compiling zerovec v0.11.5 [INFO] [stderr] Compiling zerotrie v0.2.3 [INFO] [stderr] Checking tinystr v0.8.2 [INFO] [stderr] Checking potential_utf v0.1.4 [INFO] [stderr] Checking icu_collections v2.1.1 [INFO] [stderr] Compiling openssl-macros v0.1.1 [INFO] [stderr] Checking icu_locale_core v2.1.1 [INFO] [stderr] Checking matchers v0.2.0 [INFO] [stderr] Checking tracing v0.1.41 [INFO] [stderr] Compiling rust-embed-impl v8.9.0 [INFO] [stderr] Compiling clap_derive v4.5.49 [INFO] [stderr] Checking tower v0.4.13 [INFO] [stderr] Checking tracing-subscriber v0.3.20 [INFO] [stderr] Checking thiserror v1.0.69 [INFO] [stderr] Checking serde v1.0.228 [INFO] [stderr] Compiling zstd-safe v7.2.4 [INFO] [stderr] Checking icu_provider v2.1.1 [INFO] [stderr] Compiling zstd v0.13.3 [INFO] [stderr] Compiling icu_properties v2.1.1 [INFO] [stderr] Compiling icu_normalizer v2.1.1 [INFO] [stderr] Checking time v0.3.44 [INFO] [stderr] Compiling include-flate-compress v0.3.1 [INFO] [stderr] Compiling either v1.15.0 [INFO] [stderr] Checking serde_urlencoded v0.7.1 [INFO] [stderr] Checking idna_adapter v1.2.1 [INFO] [stderr] Compiling include-flate-codegen v0.3.1 [INFO] [stderr] Checking idna v1.1.0 [INFO] [stderr] Checking serde_spanned v0.6.9 [INFO] [stderr] Checking toml_datetime v0.6.11 [INFO] [stderr] Checking dashmap v5.5.3 [INFO] [stderr] Checking url v2.5.7 [INFO] [stderr] Checking toml_edit v0.22.27 [INFO] [stderr] Checking clap v4.5.53 [INFO] [stderr] Checking include-flate v0.3.1 [INFO] [stderr] Checking rust-embed v8.9.0 [INFO] [stderr] Checking axum-core v0.4.5 [INFO] [stderr] Checking futures v0.3.31 [INFO] [stderr] Compiling sqlx-core v0.7.4 [INFO] [stderr] Checking toml v0.8.23 [INFO] [stderr] Checking tower-cookies v0.10.0 [INFO] [stderr] Checking tokio-util v0.7.17 [INFO] [stderr] Checking hyper v1.8.1 [INFO] [stderr] Checking tower-sessions-core v0.12.3 [INFO] [stderr] Checking tokio-native-tls v0.3.1 [INFO] [stderr] Checking tower v0.5.2 [INFO] [stderr] Checking tokio-rustls v0.24.1 [INFO] [stderr] Compiling sqlx-sqlite v0.7.4 [INFO] [stderr] Checking h2 v0.3.27 [INFO] [stderr] Checking tower-http v0.5.2 [INFO] [stderr] Checking tower-sessions-memory-store v0.12.3 [INFO] [stderr] Checking tower-sessions v0.12.3 [INFO] [stderr] Checking hyper-util v0.1.18 [INFO] [stderr] Checking axum v0.7.9 [INFO] [stderr] Compiling sqlx-macros-core v0.7.4 [INFO] [stderr] Compiling sqlx-macros v0.7.4 [INFO] [stderr] Checking sqlx v0.7.4 [INFO] [stderr] Checking hyper v0.14.32 [INFO] [stderr] Checking axum-extra v0.9.6 [INFO] [stderr] Checking hyper-tls v0.5.0 [INFO] [stderr] Checking hyper-rustls v0.24.2 [INFO] [stderr] Checking reqwest v0.11.27 [INFO] [stderr] Checking gemini-balance v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: unused imports: `Html` and `routing::get` [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:4:30 [INFO] [stdout] | [INFO] [stdout] 4 | response::{IntoResponse, Html, Json}, [INFO] [stdout] | ^^^^ [INFO] [stdout] 5 | http::StatusCode, [INFO] [stdout] 6 | routing::get, [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `RngCore` [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:10:12 [INFO] [stdout] | [INFO] [stdout] 10 | use rand::{RngCore}; [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/web/admin/handlers/simple.rs:9:1 [INFO] [stdout] | [INFO] [stdout] 9 | / /// 简单的管理处理器,用于基本功能展示 [INFO] [stdout] 10 | | [INFO] [stdout] | |_^ [INFO] [stdout] ... [INFO] [stdout] 13 | pub struct ApiResponse { [INFO] [stdout] | ---------------------- the comment documents this struct [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the documentation should include the empty line include it in the comment [INFO] [stdout] | [INFO] [stdout] 10 | /// [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused imports: `Html` and `routing::get` [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:4:30 [INFO] [stdout] | [INFO] [stdout] 4 | response::{IntoResponse, Html, Json}, [INFO] [stdout] | ^^^^ [INFO] [stdout] 5 | http::StatusCode, [INFO] [stdout] 6 | routing::get, [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `RngCore` [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:10:12 [INFO] [stdout] | [INFO] [stdout] 10 | use rand::{RngCore}; [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/web/admin/handlers/simple.rs:9:1 [INFO] [stdout] | [INFO] [stdout] 9 | / /// 简单的管理处理器,用于基本功能展示 [INFO] [stdout] 10 | | [INFO] [stdout] | |_^ [INFO] [stdout] ... [INFO] [stdout] 13 | pub struct ApiResponse { [INFO] [stdout] | ---------------------- the comment documents this struct [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the documentation should include the empty line include it in the comment [INFO] [stdout] | [INFO] [stdout] 10 | /// [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `GeminiRequest` [INFO] [stdout] --> src/lib.rs:165:39 [INFO] [stdout] | [INFO] [stdout] 165 | Content, ContentPart, GeminiRequest, [INFO] [stdout] | ^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `chrono::TimeZone` [INFO] [stdout] --> src/lib.rs:170:9 [INFO] [stdout] | [INFO] [stdout] 170 | use chrono::TimeZone; [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you don't need to add `&` to all patterns [INFO] [stdout] --> src/logger.rs:24:25 [INFO] [stdout] | [INFO] [stdout] 24 | let level_str = match level { [INFO] [stdout] | _________________________^ [INFO] [stdout] 25 | | &Level::ERROR => "ERROR", [INFO] [stdout] 26 | | &Level::WARN => "WARN", [INFO] [stdout] 27 | | &Level::INFO => "INFO", [INFO] [stdout] 28 | | &Level::DEBUG => "DEBUG", [INFO] [stdout] 29 | | &Level::TRACE => "TRACE", [INFO] [stdout] 30 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats [INFO] [stdout] = note: `#[warn(clippy::match_ref_pats)]` on by default [INFO] [stdout] help: instead of prefixing all patterns with `&`, you can dereference the expression [INFO] [stdout] | [INFO] [stdout] 24 ~ let level_str = match *level { [INFO] [stdout] 25 ~ Level::ERROR => "ERROR", [INFO] [stdout] 26 ~ Level::WARN => "WARN", [INFO] [stdout] 27 ~ Level::INFO => "INFO", [INFO] [stdout] 28 ~ Level::DEBUG => "DEBUG", [INFO] [stdout] 29 ~ Level::TRACE => "TRACE", [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/models_management.rs:73:5 [INFO] [stdout] | [INFO] [stdout] 73 | / if default_model.is_none() || default_model.as_ref().map(|m| m.id) == Some(model.id) { [INFO] [stdout] 74 | | if let Err(e) = app_state.model_category_repo.set_default_model(request.category_id, model.id).await { [INFO] [stdout] 75 | | tracing::error!("设置默认模型失败: {}", e); [INFO] [stdout] 76 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 77 | | } [INFO] [stdout] 78 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 73 ~ if (default_model.is_none() || default_model.as_ref().map(|m| m.id) == Some(model.id)) { [INFO] [stdout] 74 ~ && let Err(e) = app_state.model_category_repo.set_default_model(request.category_id, model.id).await { [INFO] [stdout] 75 | tracing::error!("设置默认模型失败: {}", e); [INFO] [stdout] 76 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 77 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you don't need to add `&` to all patterns [INFO] [stdout] --> src/logger.rs:24:25 [INFO] [stdout] | [INFO] [stdout] 24 | let level_str = match level { [INFO] [stdout] | _________________________^ [INFO] [stdout] 25 | | &Level::ERROR => "ERROR", [INFO] [stdout] 26 | | &Level::WARN => "WARN", [INFO] [stdout] 27 | | &Level::INFO => "INFO", [INFO] [stdout] 28 | | &Level::DEBUG => "DEBUG", [INFO] [stdout] 29 | | &Level::TRACE => "TRACE", [INFO] [stdout] 30 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats [INFO] [stdout] = note: `#[warn(clippy::match_ref_pats)]` on by default [INFO] [stdout] help: instead of prefixing all patterns with `&`, you can dereference the expression [INFO] [stdout] | [INFO] [stdout] 24 ~ let level_str = match *level { [INFO] [stdout] 25 ~ Level::ERROR => "ERROR", [INFO] [stdout] 26 ~ Level::WARN => "WARN", [INFO] [stdout] 27 ~ Level::INFO => "INFO", [INFO] [stdout] 28 ~ Level::DEBUG => "DEBUG", [INFO] [stdout] 29 ~ Level::TRACE => "TRACE", [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/models_management.rs:301:9 [INFO] [stdout] | [INFO] [stdout] 301 | / if let Some(default_model) = new_default { [INFO] [stdout] 302 | | if let Err(e) = app_state.model_category_repo.set_default_model(model.category_id, default_model.id).await { [INFO] [stdout] 303 | | tracing::error!("设置新的默认模型失败: {}", e); [INFO] [stdout] 304 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 305 | | } [INFO] [stdout] 306 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 301 ~ if let Some(default_model) = new_default [INFO] [stdout] 302 ~ && let Err(e) = app_state.model_category_repo.set_default_model(model.category_id, default_model.id).await { [INFO] [stdout] 303 | tracing::error!("设置新的默认模型失败: {}", e); [INFO] [stdout] 304 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 305 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/models_management.rs:392:5 [INFO] [stdout] | [INFO] [stdout] 392 | / if new_index == 0 { [INFO] [stdout] 393 | | if let Err(e) = app_state.model_category_repo.set_default_model(model.category_id, model_id).await { [INFO] [stdout] 394 | | tracing::error!("设置默认模型失败: {}", e); [INFO] [stdout] 395 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 396 | | } [INFO] [stdout] 397 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 392 ~ if new_index == 0 [INFO] [stdout] 393 ~ && let Err(e) = app_state.model_category_repo.set_default_model(model.category_id, model_id).await { [INFO] [stdout] 394 | tracing::error!("设置默认模型失败: {}", e); [INFO] [stdout] 395 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 396 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/models_management.rs:73:5 [INFO] [stdout] | [INFO] [stdout] 73 | / if default_model.is_none() || default_model.as_ref().map(|m| m.id) == Some(model.id) { [INFO] [stdout] 74 | | if let Err(e) = app_state.model_category_repo.set_default_model(request.category_id, model.id).await { [INFO] [stdout] 75 | | tracing::error!("设置默认模型失败: {}", e); [INFO] [stdout] 76 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 77 | | } [INFO] [stdout] 78 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 73 ~ if (default_model.is_none() || default_model.as_ref().map(|m| m.id) == Some(model.id)) { [INFO] [stdout] 74 ~ && let Err(e) = app_state.model_category_repo.set_default_model(request.category_id, model.id).await { [INFO] [stdout] 75 | tracing::error!("设置默认模型失败: {}", e); [INFO] [stdout] 76 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 77 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:262:5 [INFO] [stdout] | [INFO] [stdout] 262 | / if let Some(pwd) = password { [INFO] [stdout] 263 | | if let Err(e) = app_state.user_repo.update_password(&existing_user.username, &pwd, false).await { [INFO] [stdout] 264 | | tracing::error!("更新密码失败: {}", e); [INFO] [stdout] 265 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 266 | | } [INFO] [stdout] 267 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 262 ~ if let Some(pwd) = password [INFO] [stdout] 263 ~ && let Err(e) = app_state.user_repo.update_password(&existing_user.username, &pwd, false).await { [INFO] [stdout] 264 | tracing::error!("更新密码失败: {}", e); [INFO] [stdout] 265 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 266 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:436:13 [INFO] [stdout] | [INFO] [stdout] 436 | / return Json(serde_json::json!({ [INFO] [stdout] 437 | | "success": true, [INFO] [stdout] 438 | | "message": "登录成功", [INFO] [stdout] 439 | | "user": { [INFO] [stdout] ... | [INFO] [stdout] 448 | | })).into_response(); [INFO] [stdout] | |_______________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 436 ~ Json(serde_json::json!({ [INFO] [stdout] 437 + "success": true, [INFO] [stdout] 438 ~ "message": "登录成功", [INFO] [stdout] 439 + "user": { [INFO] [stdout] 440 + "id": user.id, [INFO] [stdout] 441 + "username": user.username, [INFO] [stdout] 442 + "email": user.email, [INFO] [stdout] 443 + "is_active": user.is_active, [INFO] [stdout] 444 + "must_change_password": user.must_change_password, [INFO] [stdout] 445 + "last_login": user.last_login_at.map(|dt| dt.to_rfc3339()), [INFO] [stdout] 446 + "created_at": user.created_at.to_rfc3339(), [INFO] [stdout] 447 + } [INFO] [stdout] 448 ~ })).into_response() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:456:13 [INFO] [stdout] | [INFO] [stdout] 456 | return (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 456 - return (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response(); [INFO] [stdout] 456 + (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/models_management.rs:301:9 [INFO] [stdout] | [INFO] [stdout] 301 | / if let Some(default_model) = new_default { [INFO] [stdout] 302 | | if let Err(e) = app_state.model_category_repo.set_default_model(model.category_id, default_model.id).await { [INFO] [stdout] 303 | | tracing::error!("设置新的默认模型失败: {}", e); [INFO] [stdout] 304 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 305 | | } [INFO] [stdout] 306 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 301 ~ if let Some(default_model) = new_default [INFO] [stdout] 302 ~ && let Err(e) = app_state.model_category_repo.set_default_model(model.category_id, default_model.id).await { [INFO] [stdout] 303 | tracing::error!("设置新的默认模型失败: {}", e); [INFO] [stdout] 304 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 305 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:373:9 [INFO] [stdout] | [INFO] [stdout] 373 | / if let Some(failure) = login_failures.get(username) { [INFO] [stdout] 374 | | if let Some(locked_until) = failure.locked_until { [INFO] [stdout] 375 | | if Utc::now() < locked_until { [INFO] [stdout] 376 | | return ( [INFO] [stdout] ... | [INFO] [stdout] 382 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 373 ~ if let Some(failure) = login_failures.get(username) [INFO] [stdout] 374 ~ && let Some(locked_until) = failure.locked_until { [INFO] [stdout] 375 | if Utc::now() < locked_until { [INFO] [stdout] ... [INFO] [stdout] 380 | } [INFO] [stdout] 381 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:374:13 [INFO] [stdout] | [INFO] [stdout] 374 | / if let Some(locked_until) = failure.locked_until { [INFO] [stdout] 375 | | if Utc::now() < locked_until { [INFO] [stdout] 376 | | return ( [INFO] [stdout] 377 | | StatusCode::TOO_MANY_REQUESTS, [INFO] [stdout] ... | [INFO] [stdout] 381 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 374 ~ if let Some(locked_until) = failure.locked_until [INFO] [stdout] 375 ~ && Utc::now() < locked_until { [INFO] [stdout] 376 | return ( [INFO] [stdout] ... [INFO] [stdout] 379 | ).into_response(); [INFO] [stdout] 380 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/models_management.rs:392:5 [INFO] [stdout] | [INFO] [stdout] 392 | / if new_index == 0 { [INFO] [stdout] 393 | | if let Err(e) = app_state.model_category_repo.set_default_model(model.category_id, model_id).await { [INFO] [stdout] 394 | | tracing::error!("设置默认模型失败: {}", e); [INFO] [stdout] 395 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 396 | | } [INFO] [stdout] 397 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 392 ~ if new_index == 0 [INFO] [stdout] 393 ~ && let Err(e) = app_state.model_category_repo.set_default_model(model.category_id, model_id).await { [INFO] [stdout] 394 | tracing::error!("设置默认模型失败: {}", e); [INFO] [stdout] 395 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 396 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:74:5 [INFO] [stdout] | [INFO] [stdout] 74 | / if let Some(host) = request.server_host { [INFO] [stdout] 75 | | if let Err(e) = app_state.system_config_repo.set_string("server_host", &host, None).await { [INFO] [stdout] 76 | | tracing::error!("更新服务器主机失败: {}", e); [INFO] [stdout] 77 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 78 | | } [INFO] [stdout] 79 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 74 ~ if let Some(host) = request.server_host [INFO] [stdout] 75 ~ && let Err(e) = app_state.system_config_repo.set_string("server_host", &host, None).await { [INFO] [stdout] 76 | tracing::error!("更新服务器主机失败: {}", e); [INFO] [stdout] 77 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 78 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:81:5 [INFO] [stdout] | [INFO] [stdout] 81 | / if let Some(port) = request.server_port { [INFO] [stdout] 82 | | if let Err(e) = app_state.system_config_repo.set_number("server_port", port as i32, None).await { [INFO] [stdout] 83 | | tracing::error!("更新服务器端口失败: {}", e); [INFO] [stdout] 84 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 85 | | } [INFO] [stdout] 86 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 81 ~ if let Some(port) = request.server_port [INFO] [stdout] 82 ~ && let Err(e) = app_state.system_config_repo.set_number("server_port", port as i32, None).await { [INFO] [stdout] 83 | tracing::error!("更新服务器端口失败: {}", e); [INFO] [stdout] 84 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 85 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:88:5 [INFO] [stdout] | [INFO] [stdout] 88 | / if let Some(url) = request.upstream_gemini_url { [INFO] [stdout] 89 | | if let Err(e) = app_state.system_config_repo.set_string("upstream_gemini_url", &url, None).await { [INFO] [stdout] 90 | | tracing::error!("更新上游Gemini URL失败: {}", e); [INFO] [stdout] 91 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 92 | | } [INFO] [stdout] 93 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 88 ~ if let Some(url) = request.upstream_gemini_url [INFO] [stdout] 89 ~ && let Err(e) = app_state.system_config_repo.set_string("upstream_gemini_url", &url, None).await { [INFO] [stdout] 90 | tracing::error!("更新上游Gemini URL失败: {}", e); [INFO] [stdout] 91 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 92 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:95:5 [INFO] [stdout] | [INFO] [stdout] 95 | / if let Some(timeout) = request.upstream_gemini_timeout { [INFO] [stdout] 96 | | if let Err(e) = app_state.system_config_repo.set_number("upstream_gemini_timeout", timeout as i32, None).await { [INFO] [stdout] 97 | | tracing::error!("更新上游Gemini超时失败: {}", e); [INFO] [stdout] 98 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 99 | | } [INFO] [stdout] 100 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 95 ~ if let Some(timeout) = request.upstream_gemini_timeout [INFO] [stdout] 96 ~ && let Err(e) = app_state.system_config_repo.set_number("upstream_gemini_timeout", timeout as i32, None).await { [INFO] [stdout] 97 | tracing::error!("更新上游Gemini超时失败: {}", e); [INFO] [stdout] 98 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 99 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:102:5 [INFO] [stdout] | [INFO] [stdout] 102 | / if let Some(reset_time) = request.rpd_reset_time { [INFO] [stdout] 103 | | if let Err(e) = app_state.system_config_repo.set_string("rpd_reset_time", &reset_time, None).await { [INFO] [stdout] 104 | | tracing::error!("更新RPD重置时间失败: {}", e); [INFO] [stdout] 105 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 106 | | } [INFO] [stdout] 107 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 102 ~ if let Some(reset_time) = request.rpd_reset_time [INFO] [stdout] 103 ~ && let Err(e) = app_state.system_config_repo.set_string("rpd_reset_time", &reset_time, None).await { [INFO] [stdout] 104 | tracing::error!("更新RPD重置时间失败: {}", e); [INFO] [stdout] 105 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 106 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:109:5 [INFO] [stdout] | [INFO] [stdout] 109 | / if let Some(level) = request.log_level { [INFO] [stdout] 110 | | if let Err(e) = app_state.system_config_repo.set_string("log_level", &level, None).await { [INFO] [stdout] 111 | | tracing::error!("更新日志级别失败: {}", e); [INFO] [stdout] 112 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 113 | | } [INFO] [stdout] 114 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 109 ~ if let Some(level) = request.log_level [INFO] [stdout] 110 ~ && let Err(e) = app_state.system_config_repo.set_string("log_level", &level, None).await { [INFO] [stdout] 111 | tracing::error!("更新日志级别失败: {}", e); [INFO] [stdout] 112 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 113 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:116:5 [INFO] [stdout] | [INFO] [stdout] 116 | / if let Some(max_entries) = request.log_max_entries { [INFO] [stdout] 117 | | if let Err(e) = app_state.system_config_repo.set_number("log_max_entries", max_entries as i32, None).await { [INFO] [stdout] 118 | | tracing::error!("更新日志最大条目失败: {}", e); [INFO] [stdout] 119 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 120 | | } [INFO] [stdout] 121 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 116 ~ if let Some(max_entries) = request.log_max_entries [INFO] [stdout] 117 ~ && let Err(e) = app_state.system_config_repo.set_number("log_max_entries", max_entries as i32, None).await { [INFO] [stdout] 118 | tracing::error!("更新日志最大条目失败: {}", e); [INFO] [stdout] 119 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 120 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:125:5 [INFO] [stdout] | [INFO] [stdout] 125 | / if let Some(days) = request.stats_retention_days { [INFO] [stdout] 126 | | if let Err(e) = app_state.system_config_repo.set_number("stats_retention_days", days as i32, None).await { [INFO] [stdout] 127 | | tracing::error!("更新统计保留天数失败: {}", e); [INFO] [stdout] 128 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 129 | | } [INFO] [stdout] 130 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 125 ~ if let Some(days) = request.stats_retention_days [INFO] [stdout] 126 ~ && let Err(e) = app_state.system_config_repo.set_number("stats_retention_days", days as i32, None).await { [INFO] [stdout] 127 | tracing::error!("更新统计保留天数失败: {}", e); [INFO] [stdout] 128 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 129 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:262:5 [INFO] [stdout] | [INFO] [stdout] 262 | / if let Some(pwd) = password { [INFO] [stdout] 263 | | if let Err(e) = app_state.user_repo.update_password(&existing_user.username, &pwd, false).await { [INFO] [stdout] 264 | | tracing::error!("更新密码失败: {}", e); [INFO] [stdout] 265 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 266 | | } [INFO] [stdout] 267 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 262 ~ if let Some(pwd) = password [INFO] [stdout] 263 ~ && let Err(e) = app_state.user_repo.update_password(&existing_user.username, &pwd, false).await { [INFO] [stdout] 264 | tracing::error!("更新密码失败: {}", e); [INFO] [stdout] 265 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 266 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:436:13 [INFO] [stdout] | [INFO] [stdout] 436 | / return Json(serde_json::json!({ [INFO] [stdout] 437 | | "success": true, [INFO] [stdout] 438 | | "message": "登录成功", [INFO] [stdout] 439 | | "user": { [INFO] [stdout] ... | [INFO] [stdout] 448 | | })).into_response(); [INFO] [stdout] | |_______________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 436 ~ Json(serde_json::json!({ [INFO] [stdout] 437 + "success": true, [INFO] [stdout] 438 ~ "message": "登录成功", [INFO] [stdout] 439 + "user": { [INFO] [stdout] 440 + "id": user.id, [INFO] [stdout] 441 + "username": user.username, [INFO] [stdout] 442 + "email": user.email, [INFO] [stdout] 443 + "is_active": user.is_active, [INFO] [stdout] 444 + "must_change_password": user.must_change_password, [INFO] [stdout] 445 + "last_login": user.last_login_at.map(|dt| dt.to_rfc3339()), [INFO] [stdout] 446 + "created_at": user.created_at.to_rfc3339(), [INFO] [stdout] 447 + } [INFO] [stdout] 448 ~ })).into_response() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:456:13 [INFO] [stdout] | [INFO] [stdout] 456 | return (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 456 - return (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response(); [INFO] [stdout] 456 + (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:373:9 [INFO] [stdout] | [INFO] [stdout] 373 | / if let Some(failure) = login_failures.get(username) { [INFO] [stdout] 374 | | if let Some(locked_until) = failure.locked_until { [INFO] [stdout] 375 | | if Utc::now() < locked_until { [INFO] [stdout] 376 | | return ( [INFO] [stdout] ... | [INFO] [stdout] 382 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 373 ~ if let Some(failure) = login_failures.get(username) [INFO] [stdout] 374 ~ && let Some(locked_until) = failure.locked_until { [INFO] [stdout] 375 | if Utc::now() < locked_until { [INFO] [stdout] ... [INFO] [stdout] 380 | } [INFO] [stdout] 381 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/user_management.rs:374:13 [INFO] [stdout] | [INFO] [stdout] 374 | / if let Some(locked_until) = failure.locked_until { [INFO] [stdout] 375 | | if Utc::now() < locked_until { [INFO] [stdout] 376 | | return ( [INFO] [stdout] 377 | | StatusCode::TOO_MANY_REQUESTS, [INFO] [stdout] ... | [INFO] [stdout] 381 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 374 ~ if let Some(locked_until) = failure.locked_until [INFO] [stdout] 375 ~ && Utc::now() < locked_until { [INFO] [stdout] 376 | return ( [INFO] [stdout] ... [INFO] [stdout] 379 | ).into_response(); [INFO] [stdout] 380 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:74:5 [INFO] [stdout] | [INFO] [stdout] 74 | / if let Some(host) = request.server_host { [INFO] [stdout] 75 | | if let Err(e) = app_state.system_config_repo.set_string("server_host", &host, None).await { [INFO] [stdout] 76 | | tracing::error!("更新服务器主机失败: {}", e); [INFO] [stdout] 77 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 78 | | } [INFO] [stdout] 79 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 74 ~ if let Some(host) = request.server_host [INFO] [stdout] 75 ~ && let Err(e) = app_state.system_config_repo.set_string("server_host", &host, None).await { [INFO] [stdout] 76 | tracing::error!("更新服务器主机失败: {}", e); [INFO] [stdout] 77 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 78 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:81:5 [INFO] [stdout] | [INFO] [stdout] 81 | / if let Some(port) = request.server_port { [INFO] [stdout] 82 | | if let Err(e) = app_state.system_config_repo.set_number("server_port", port as i32, None).await { [INFO] [stdout] 83 | | tracing::error!("更新服务器端口失败: {}", e); [INFO] [stdout] 84 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 85 | | } [INFO] [stdout] 86 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 81 ~ if let Some(port) = request.server_port [INFO] [stdout] 82 ~ && let Err(e) = app_state.system_config_repo.set_number("server_port", port as i32, None).await { [INFO] [stdout] 83 | tracing::error!("更新服务器端口失败: {}", e); [INFO] [stdout] 84 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 85 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:88:5 [INFO] [stdout] | [INFO] [stdout] 88 | / if let Some(url) = request.upstream_gemini_url { [INFO] [stdout] 89 | | if let Err(e) = app_state.system_config_repo.set_string("upstream_gemini_url", &url, None).await { [INFO] [stdout] 90 | | tracing::error!("更新上游Gemini URL失败: {}", e); [INFO] [stdout] 91 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 92 | | } [INFO] [stdout] 93 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 88 ~ if let Some(url) = request.upstream_gemini_url [INFO] [stdout] 89 ~ && let Err(e) = app_state.system_config_repo.set_string("upstream_gemini_url", &url, None).await { [INFO] [stdout] 90 | tracing::error!("更新上游Gemini URL失败: {}", e); [INFO] [stdout] 91 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 92 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:95:5 [INFO] [stdout] | [INFO] [stdout] 95 | / if let Some(timeout) = request.upstream_gemini_timeout { [INFO] [stdout] 96 | | if let Err(e) = app_state.system_config_repo.set_number("upstream_gemini_timeout", timeout as i32, None).await { [INFO] [stdout] 97 | | tracing::error!("更新上游Gemini超时失败: {}", e); [INFO] [stdout] 98 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 99 | | } [INFO] [stdout] 100 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 95 ~ if let Some(timeout) = request.upstream_gemini_timeout [INFO] [stdout] 96 ~ && let Err(e) = app_state.system_config_repo.set_number("upstream_gemini_timeout", timeout as i32, None).await { [INFO] [stdout] 97 | tracing::error!("更新上游Gemini超时失败: {}", e); [INFO] [stdout] 98 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 99 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:102:5 [INFO] [stdout] | [INFO] [stdout] 102 | / if let Some(reset_time) = request.rpd_reset_time { [INFO] [stdout] 103 | | if let Err(e) = app_state.system_config_repo.set_string("rpd_reset_time", &reset_time, None).await { [INFO] [stdout] 104 | | tracing::error!("更新RPD重置时间失败: {}", e); [INFO] [stdout] 105 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 106 | | } [INFO] [stdout] 107 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 102 ~ if let Some(reset_time) = request.rpd_reset_time [INFO] [stdout] 103 ~ && let Err(e) = app_state.system_config_repo.set_string("rpd_reset_time", &reset_time, None).await { [INFO] [stdout] 104 | tracing::error!("更新RPD重置时间失败: {}", e); [INFO] [stdout] 105 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 106 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:109:5 [INFO] [stdout] | [INFO] [stdout] 109 | / if let Some(level) = request.log_level { [INFO] [stdout] 110 | | if let Err(e) = app_state.system_config_repo.set_string("log_level", &level, None).await { [INFO] [stdout] 111 | | tracing::error!("更新日志级别失败: {}", e); [INFO] [stdout] 112 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 113 | | } [INFO] [stdout] 114 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 109 ~ if let Some(level) = request.log_level [INFO] [stdout] 110 ~ && let Err(e) = app_state.system_config_repo.set_string("log_level", &level, None).await { [INFO] [stdout] 111 | tracing::error!("更新日志级别失败: {}", e); [INFO] [stdout] 112 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 113 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:116:5 [INFO] [stdout] | [INFO] [stdout] 116 | / if let Some(max_entries) = request.log_max_entries { [INFO] [stdout] 117 | | if let Err(e) = app_state.system_config_repo.set_number("log_max_entries", max_entries as i32, None).await { [INFO] [stdout] 118 | | tracing::error!("更新日志最大条目失败: {}", e); [INFO] [stdout] 119 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 120 | | } [INFO] [stdout] 121 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 116 ~ if let Some(max_entries) = request.log_max_entries [INFO] [stdout] 117 ~ && let Err(e) = app_state.system_config_repo.set_number("log_max_entries", max_entries as i32, None).await { [INFO] [stdout] 118 | tracing::error!("更新日志最大条目失败: {}", e); [INFO] [stdout] 119 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 120 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/web/admin/handlers/config_management.rs:125:5 [INFO] [stdout] | [INFO] [stdout] 125 | / if let Some(days) = request.stats_retention_days { [INFO] [stdout] 126 | | if let Err(e) = app_state.system_config_repo.set_number("stats_retention_days", days as i32, None).await { [INFO] [stdout] 127 | | tracing::error!("更新统计保留天数失败: {}", e); [INFO] [stdout] 128 | | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 129 | | } [INFO] [stdout] 130 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 125 ~ if let Some(days) = request.stats_retention_days [INFO] [stdout] 126 ~ && let Err(e) = app_state.system_config_repo.set_number("stats_retention_days", days as i32, None).await { [INFO] [stdout] 127 | tracing::error!("更新统计保留天数失败: {}", e); [INFO] [stdout] 128 | return Err(StatusCode::INTERNAL_SERVER_ERROR); [INFO] [stdout] 129 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/proxy.rs:325:5 [INFO] [stdout] | [INFO] [stdout] 79 | / let response = { [INFO] [stdout] 80 | | let _final_request_body_json = Value::Null; [INFO] [stdout] 81 | | let mut target_model_id = "gemini-pro".to_string(); // Default model [INFO] [stdout] 82 | | let mut stream_response = false; [INFO] [stdout] ... | [INFO] [stdout] 323 | | }; [INFO] [stdout] | |______- unnecessary `let` binding [INFO] [stdout] 324 | [INFO] [stdout] 325 | response [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return [INFO] [stdout] = note: `#[warn(clippy::let_and_return)]` on by default [INFO] [stdout] help: return the expression directly [INFO] [stdout] | [INFO] [stdout] 79 ~ [INFO] [stdout] 80 | [INFO] [stdout] 81 ~ { [INFO] [stdout] 82 + let _final_request_body_json = Value::Null; [INFO] [stdout] 83 + let mut target_model_id = "gemini-pro".to_string(); // Default model [INFO] [stdout] 84 + let mut stream_response = false; [INFO] [stdout] 85 + [INFO] [stdout] 86 ~ // 从原始请求中提取模型ID [INFO] [stdout] 87 + if let Ok(request_json) = serde_json::from_str::(&body_str) { [INFO] [stdout] 88 + if let Some(model) = request_json.get("model").and_then(|m| m.as_str()) { [INFO] [stdout] 89 + target_model_id = model.to_string(); [INFO] [stdout] 90 + } [INFO] [stdout] 91 + if let Some(stream) = request_json.get("stream").and_then(|s| s.as_bool()) { [INFO] [stdout] 92 + stream_response = stream; [INFO] [stdout] 93 + } [INFO] [stdout] 94 + } [INFO] [stdout] 95 + [INFO] [stdout] 96 + // Now get an API key that's not restricted for this specific model [INFO] [stdout] 97 + if let Some(key) = app_state.key_pool.get_next_healthy_key_for_model(&target_model_id).await { [INFO] [stdout] 98 + upstream_gemini_key = Some(key.clone()); [INFO] [stdout] 99 + tracing::info!("Selected key {} for model {}", mask_api_key(&key), target_model_id); [INFO] [stdout] 100 + } [INFO] [stdout] 101 + [INFO] [stdout] 102 + let upstream_gemini_key_id = upstream_gemini_key.clone().unwrap_or_else(|| "unknown".to_string()); [INFO] [stdout] 103 + [INFO] [stdout] 104 + // Check if we have a valid API key for this model [INFO] [stdout] 105 + let api_key = upstream_gemini_key.as_deref().ok_or_else(|| { [INFO] [stdout] 106 + tracing::error!("No available Gemini API keys for model: {}", target_model_id); [INFO] [stdout] 107 + (StatusCode::SERVICE_UNAVAILABLE, format!("No available API keys for model: {}", target_model_id)).into_response() [INFO] [stdout] 108 + })?; [INFO] [stdout] 109 + [INFO] [stdout] 110 + [INFO] [stdout] 111 + [INFO] [stdout] 112 ~ // 使用简化的转换器自动检测和转换格式 [INFO] [stdout] 113 + tracing::info!("Request body (first 500 chars): {}", &body_str.chars().take(500).collect::()); [INFO] [stdout] 114 + tracing::info!("URI path: {}", uri_path); [INFO] [stdout] 115 + [INFO] [stdout] 116 + let gemini_request = match SimpleTransformerFactory::auto_convert_request(&body_str, &uri_path) { [INFO] [stdout] 117 + Ok(request) => request, [INFO] [stdout] 118 + Err(e) => { [INFO] [stdout] 119 + tracing::error!("Request conversion failed: {}", e); [INFO] [stdout] 120 + tracing::error!("Failed request body (first 1000 chars): {}", &body_str.chars().take(1000).collect::()); [INFO] [stdout] 121 + [INFO] [stdout] 122 + // Record statistics for request conversion failure [INFO] [stdout] 123 + if let Some(ref key) = upstream_gemini_key { [INFO] [stdout] 124 + app_state.key_pool.mark_key_failure(key).await; [INFO] [stdout] 125 + app_state.stats.record_request( [INFO] [stdout] 126 + key, [INFO] [stdout] 127 + &target_model_id, [INFO] [stdout] 128 + &client_key_id, [INFO] [stdout] 129 + start_time.elapsed(), [INFO] [stdout] 130 + false, [INFO] [stdout] 131 + ); [INFO] [stdout] 132 + } [INFO] [stdout] 133 + [INFO] [stdout] 134 + return Err((StatusCode::BAD_REQUEST, format!("Request conversion failed: {}", e)).into_response()); [INFO] [stdout] 135 + } [INFO] [stdout] 136 + }; [INFO] [stdout] 137 + [INFO] [stdout] 138 + tracing::debug!("Request conversion successful, contents count: {}", gemini_request.contents.len()); [INFO] [stdout] 139 + [INFO] [stdout] 140 + // Perform upstream call [INFO] [stdout] 141 + let upstream_client = GeminiUpstreamClient::new(app_state.config.upstream.gemini.base_url.clone()); [INFO] [stdout] 142 + [INFO] [stdout] 143 + tracing::debug!("About to convert request for path: {}", uri_path); [INFO] [stdout] 144 + [INFO] [stdout] 145 ~ // 直接使用gemini_request,我们已经有了转换好的请求 [INFO] [stdout] 146 + tracing::debug!("About to call Gemini API, model: {}, contents count: {}, api_key: {}", target_model_id, gemini_request.contents.len(), mask_api_key(api_key)); [INFO] [stdout] 147 + tracing::debug!("API endpoint: {}", app_state.config.upstream.gemini.base_url); [INFO] [stdout] 148 + [INFO] [stdout] 149 + let upstream_response = upstream_client [INFO] [stdout] 150 + .generate_content( [INFO] [stdout] 151 + &target_model_id, [INFO] [stdout] 152 + api_key, [INFO] [stdout] 153 + &gemini_request, [INFO] [stdout] 154 + stream_response, [INFO] [stdout] 155 + ) [INFO] [stdout] 156 + .await; [INFO] [stdout] 157 + [INFO] [stdout] 158 + tracing::debug!("Gemini API call completed"); [INFO] [stdout] 159 + [INFO] [stdout] 160 + match upstream_response { [INFO] [stdout] 161 + Ok(res) => { [INFO] [stdout] 162 + let status = res.status().as_u16(); [INFO] [stdout] 163 + let success = status >= 200 && status < 300; [INFO] [stdout] 164 + tracing::debug!("Gemini API response status: {}, success: {}, api_key: {}", status, success, mask_api_key(api_key)); [INFO] [stdout] 165 + [INFO] [stdout] 166 + // Check for 403 error - move key to restricted list for this specific model [INFO] [stdout] 167 + if status == 403 { [INFO] [stdout] 168 + tracing::warn!("403 error detected for key {} on model {}, moving to restricted list", mask_api_key(api_key), target_model_id); [INFO] [stdout] 169 + app_state.key_pool.move_key_to_restricted(&upstream_gemini_key_id, &target_model_id).await; [INFO] [stdout] 170 + [INFO] [stdout] 171 + // Update key health for 403 error [INFO] [stdout] 172 + app_state.key_pool.mark_key_failure(&upstream_gemini_key_id).await; [INFO] [stdout] 173 + [INFO] [stdout] 174 + // Record statistics for 403 error [INFO] [stdout] 175 + app_state.stats.record_request( [INFO] [stdout] 176 + &upstream_gemini_key_id, [INFO] [stdout] 177 + &target_model_id, [INFO] [stdout] 178 + &client_key_id, [INFO] [stdout] 179 + start_time.elapsed(), [INFO] [stdout] 180 + false, // 403 is a failure [INFO] [stdout] 181 + ); [INFO] [stdout] 182 + [INFO] [stdout] 183 + // Try to read response body to get error details [INFO] [stdout] 184 + let error_content = if let Ok(res_bytes) = res.bytes().await { [INFO] [stdout] 185 + let response_str = String::from_utf8_lossy(&res_bytes); [INFO] [stdout] 186 + tracing::error!("403 Error details for model {}: {}", target_model_id, response_str); [INFO] [stdout] 187 + Some(response_str.to_string()) [INFO] [stdout] 188 + } else { [INFO] [stdout] 189 + None [INFO] [stdout] 190 + }; [INFO] [stdout] 191 + [INFO] [stdout] 192 ~ // 记录403错误日志 [INFO] [stdout] 193 + log_api_request( [INFO] [stdout] 194 + &app_state, [INFO] [stdout] 195 + &upstream_gemini_key_id, [INFO] [stdout] 196 + &target_model_id, [INFO] [stdout] 197 + 403, [INFO] [stdout] 198 + error_content, [INFO] [stdout] 199 + "403 Forbidden - API key temporarily unavailable", [INFO] [stdout] 200 + false, [INFO] [stdout] 201 + ).await; [INFO] [stdout] 202 + [INFO] [stdout] 203 + return Err((StatusCode::SERVICE_UNAVAILABLE, "API key temporarily unavailable (403 error)").into_response()); [INFO] [stdout] 204 + } [INFO] [stdout] 205 + [INFO] [stdout] 206 + // Update key health based on response [INFO] [stdout] 207 + if success { [INFO] [stdout] 208 + app_state.key_pool.mark_key_success(&upstream_gemini_key_id).await; [INFO] [stdout] 209 + } else if status >= 400 { [INFO] [stdout] 210 + app_state.key_pool.mark_key_failure(&upstream_gemini_key_id).await; [INFO] [stdout] 211 + } [INFO] [stdout] 212 + [INFO] [stdout] 213 + app_state.stats.record_request( [INFO] [stdout] 214 + &upstream_gemini_key_id, [INFO] [stdout] 215 + &target_model_id, [INFO] [stdout] 216 + &client_key_id, [INFO] [stdout] 217 + start_time.elapsed(), [INFO] [stdout] 218 + success, [INFO] [stdout] 219 + ); [INFO] [stdout] 220 + [INFO] [stdout] 221 + // Handle streaming responses separately [INFO] [stdout] 222 + if stream_response { [INFO] [stdout] 223 + match handle_streaming_response(res, uri_path.clone(), target_model_id).await { [INFO] [stdout] 224 + Ok(streaming_resp) => Ok(streaming_resp), [INFO] [stdout] 225 + Err(e) => { [INFO] [stdout] 226 + tracing::error!("Streaming response handling failed: {:?}", e); [INFO] [stdout] 227 + Err(e) [INFO] [stdout] 228 + } [INFO] [stdout] 229 + } [INFO] [stdout] 230 + } else { [INFO] [stdout] 231 + let res_bytes = res.bytes().await.map_err(|e| { [INFO] [stdout] 232 + tracing::error!("Failed to read response bytes: {}", e); [INFO] [stdout] 233 + (StatusCode::INTERNAL_SERVER_ERROR, format!("Response read error: {}", e)).into_response() [INFO] [stdout] 234 + })?; [INFO] [stdout] 235 + [INFO] [stdout] 236 + let response_str = String::from_utf8_lossy(&res_bytes); [INFO] [stdout] 237 + println!("=== GEMINI API RESPONSE START ==="); [INFO] [stdout] 238 + println!("Response length: {}", response_str.len()); [INFO] [stdout] 239 + println!("Raw response: {}", response_str); [INFO] [stdout] 240 + println!("=== GEMINI API RESPONSE END ==="); [INFO] [stdout] 241 + [INFO] [stdout] 242 + let gemini_response: GeminiResponse = match serde_json::from_slice::(&res_bytes) { [INFO] [stdout] 243 + Ok(response) => { [INFO] [stdout] 244 + tracing::debug!("Successfully parsed Gemini response, candidates count: {}", response.candidates.len()); [INFO] [stdout] 245 + response [INFO] [stdout] 246 + }, [INFO] [stdout] 247 + Err(e) => { [INFO] [stdout] 248 + eprintln!("=== GEMINI API PARSING ERROR ==="); [INFO] [stdout] 249 + eprintln!("Parse error: {}", e); [INFO] [stdout] 250 + eprintln!("Full response body: {}", response_str); [INFO] [stdout] 251 + eprintln!("=== ERROR END ==="); [INFO] [stdout] 252 + // Return empty response as fallback [INFO] [stdout] 253 + GeminiResponse { candidates: vec![] } [INFO] [stdout] 254 + } [INFO] [stdout] 255 + }; [INFO] [stdout] 256 + [INFO] [stdout] 257 ~ // 使用简化转换器将响应转换回原始格式 [INFO] [stdout] 258 + let target_format = if uri_path.starts_with("/openai/v1/") { [INFO] [stdout] 259 + crate::transformers::common::ApiFormat::OpenAI [INFO] [stdout] 260 + } else if uri_path.starts_with("/anthropic/v1/") { [INFO] [stdout] 261 + crate::transformers::common::ApiFormat::Anthropic [INFO] [stdout] 262 + } else if uri_path.starts_with("/v1beta/") { [INFO] [stdout] 263 + crate::transformers::common::ApiFormat::Gemini [INFO] [stdout] 264 + } else if uri_path.starts_with("/v1/") { [INFO] [stdout] 265 ~ // 检查是否是OpenAI兼容的端点 [INFO] [stdout] 266 + if uri_path.contains("/chat/completions") || uri_path.contains("/completions") || uri_path.contains("/embeddings") { [INFO] [stdout] 267 + crate::transformers::common::ApiFormat::OpenAI [INFO] [stdout] 268 + } else { [INFO] [stdout] 269 + crate::transformers::common::ApiFormat::Gemini [INFO] [stdout] 270 + } [INFO] [stdout] 271 + } else { [INFO] [stdout] 272 + crate::transformers::common::ApiFormat::Gemini [INFO] [stdout] 273 + }; [INFO] [stdout] 274 + [INFO] [stdout] 275 + let converted_response = SimpleTransformerFactory::convert_response(&gemini_response, target_format, &target_model_id) [INFO] [stdout] 276 + .map_err(|e| { [INFO] [stdout] 277 + tracing::error!("Failed to convert response: {}", e); [INFO] [stdout] 278 + (StatusCode::INTERNAL_SERVER_ERROR, format!("Response conversion failed: {}", e)).into_response() [INFO] [stdout] 279 + })?; [INFO] [stdout] 280 + [INFO] [stdout] 281 + let status_code = StatusCode::from_u16(status) [INFO] [stdout] 282 + .map_err(|_| (StatusCode::INTERNAL_SERVER_ERROR, "Invalid status code").into_response())?; [INFO] [stdout] 283 + [INFO] [stdout] 284 ~ // 记录成功的API请求日志 [INFO] [stdout] 285 + let response_content = serde_json::to_string_pretty(&converted_response).ok(); [INFO] [stdout] 286 + log_api_request( [INFO] [stdout] 287 + &app_state, [INFO] [stdout] 288 + &upstream_gemini_key_id, [INFO] [stdout] 289 + &target_model_id, [INFO] [stdout] 290 + status, [INFO] [stdout] 291 + response_content, [INFO] [stdout] 292 + &format!("Successfully processed {} request", if stream_response { "streaming" } else { "regular" }), [INFO] [stdout] 293 + true, [INFO] [stdout] 294 + ).await; [INFO] [stdout] 295 + [INFO] [stdout] 296 + Ok((status_code, Json(converted_response)).into_response()) [INFO] [stdout] 297 + } [INFO] [stdout] 298 + } [INFO] [stdout] 299 + Err(e) => { [INFO] [stdout] 300 + // Mark key as failed due to network/request error [INFO] [stdout] 301 + app_state.key_pool.mark_key_failure(&upstream_gemini_key_id).await; [INFO] [stdout] 302 + [INFO] [stdout] 303 + app_state.stats.record_request( [INFO] [stdout] 304 + &upstream_gemini_key_id, [INFO] [stdout] 305 + &target_model_id, [INFO] [stdout] 306 + &client_key_id, [INFO] [stdout] 307 + start_time.elapsed(), [INFO] [stdout] 308 + false, [INFO] [stdout] 309 + ); [INFO] [stdout] 310 + [INFO] [stdout] 311 ~ // 记录网络/请求错误日志 [INFO] [stdout] 312 + log_api_request( [INFO] [stdout] 313 + &app_state, [INFO] [stdout] 314 + &upstream_gemini_key_id, [INFO] [stdout] 315 + &target_model_id, [INFO] [stdout] 316 ~ 500, // 内部服务器错误 [INFO] [stdout] 317 + Some(format!("Network/Request error: {}", e)), [INFO] [stdout] 318 + "Upstream network or request error", [INFO] [stdout] 319 + false, [INFO] [stdout] 320 + ).await; [INFO] [stdout] 321 + [INFO] [stdout] 322 + Err((StatusCode::INTERNAL_SERVER_ERROR, format!("Upstream error: {}", e)).into_response()) [INFO] [stdout] 323 + } [INFO] [stdout] 324 + } [INFO] [stdout] 325 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual `Range::contains` implementation [INFO] [stdout] --> src/proxy.rs:161:31 [INFO] [stdout] | [INFO] [stdout] 161 | let success = status >= 200 && status < 300; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(200..300).contains(&status)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains [INFO] [stdout] = note: `#[warn(clippy::manual_range_contains)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/health_check.rs:42:28 [INFO] [stdout] | [INFO] [stdout] 42 | let should_check = key_health.is_healthy && [INFO] [stdout] | ____________________________^ [INFO] [stdout] 43 | | (now - key_health.last_check).num_minutes() >= 5 || [INFO] [stdout] 44 | | !key_health.is_healthy; [INFO] [stdout] | |__________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 42 - let should_check = key_health.is_healthy && [INFO] [stdout] 43 - (now - key_health.last_check).num_minutes() >= 5 || [INFO] [stdout] 44 - !key_health.is_healthy; [INFO] [stdout] 42 + let should_check = !(key_health.is_healthy && (now - key_health.last_check).num_minutes() < 5); [INFO] [stdout] | [INFO] [stdout] 42 - let should_check = key_health.is_healthy && [INFO] [stdout] 43 - (now - key_health.last_check).num_minutes() >= 5 || [INFO] [stdout] 44 - !key_health.is_healthy; [INFO] [stdout] 42 + let should_check = !key_health.is_healthy || (now - key_health.last_check).num_minutes() >= 5; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `QuotaResetService` [INFO] [stdout] --> src/services/quota_reset.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | / pub fn new() -> Self { [INFO] [stdout] 20 | | Self { [INFO] [stdout] 21 | | is_running: Arc::new(std::sync::atomic::AtomicBool::new(false)), [INFO] [stdout] 22 | | } [INFO] [stdout] 23 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] = note: `#[warn(clippy::new_without_default)]` on by default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 17 + impl Default for QuotaResetService { [INFO] [stdout] 18 + fn default() -> Self { [INFO] [stdout] 19 + Self::new() [INFO] [stdout] 20 + } [INFO] [stdout] 21 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/proxy.rs:325:5 [INFO] [stdout] | [INFO] [stdout] 79 | / let response = { [INFO] [stdout] 80 | | let _final_request_body_json = Value::Null; [INFO] [stdout] 81 | | let mut target_model_id = "gemini-pro".to_string(); // Default model [INFO] [stdout] 82 | | let mut stream_response = false; [INFO] [stdout] ... | [INFO] [stdout] 323 | | }; [INFO] [stdout] | |______- unnecessary `let` binding [INFO] [stdout] 324 | [INFO] [stdout] 325 | response [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return [INFO] [stdout] = note: `#[warn(clippy::let_and_return)]` on by default [INFO] [stdout] help: return the expression directly [INFO] [stdout] | [INFO] [stdout] 79 ~ [INFO] [stdout] 80 | [INFO] [stdout] 81 ~ { [INFO] [stdout] 82 + let _final_request_body_json = Value::Null; [INFO] [stdout] 83 + let mut target_model_id = "gemini-pro".to_string(); // Default model [INFO] [stdout] 84 + let mut stream_response = false; [INFO] [stdout] 85 + [INFO] [stdout] 86 ~ // 从原始请求中提取模型ID [INFO] [stdout] 87 + if let Ok(request_json) = serde_json::from_str::(&body_str) { [INFO] [stdout] 88 + if let Some(model) = request_json.get("model").and_then(|m| m.as_str()) { [INFO] [stdout] 89 + target_model_id = model.to_string(); [INFO] [stdout] 90 + } [INFO] [stdout] 91 + if let Some(stream) = request_json.get("stream").and_then(|s| s.as_bool()) { [INFO] [stdout] 92 + stream_response = stream; [INFO] [stdout] 93 + } [INFO] [stdout] 94 + } [INFO] [stdout] 95 + [INFO] [stdout] 96 + // Now get an API key that's not restricted for this specific model [INFO] [stdout] 97 + if let Some(key) = app_state.key_pool.get_next_healthy_key_for_model(&target_model_id).await { [INFO] [stdout] 98 + upstream_gemini_key = Some(key.clone()); [INFO] [stdout] 99 + tracing::info!("Selected key {} for model {}", mask_api_key(&key), target_model_id); [INFO] [stdout] 100 + } [INFO] [stdout] 101 + [INFO] [stdout] 102 + let upstream_gemini_key_id = upstream_gemini_key.clone().unwrap_or_else(|| "unknown".to_string()); [INFO] [stdout] 103 + [INFO] [stdout] 104 + // Check if we have a valid API key for this model [INFO] [stdout] 105 + let api_key = upstream_gemini_key.as_deref().ok_or_else(|| { [INFO] [stdout] 106 + tracing::error!("No available Gemini API keys for model: {}", target_model_id); [INFO] [stdout] 107 + (StatusCode::SERVICE_UNAVAILABLE, format!("No available API keys for model: {}", target_model_id)).into_response() [INFO] [stdout] 108 + })?; [INFO] [stdout] 109 + [INFO] [stdout] 110 + [INFO] [stdout] 111 + [INFO] [stdout] 112 ~ // 使用简化的转换器自动检测和转换格式 [INFO] [stdout] 113 + tracing::info!("Request body (first 500 chars): {}", &body_str.chars().take(500).collect::()); [INFO] [stdout] 114 + tracing::info!("URI path: {}", uri_path); [INFO] [stdout] 115 + [INFO] [stdout] 116 + let gemini_request = match SimpleTransformerFactory::auto_convert_request(&body_str, &uri_path) { [INFO] [stdout] 117 + Ok(request) => request, [INFO] [stdout] 118 + Err(e) => { [INFO] [stdout] 119 + tracing::error!("Request conversion failed: {}", e); [INFO] [stdout] 120 + tracing::error!("Failed request body (first 1000 chars): {}", &body_str.chars().take(1000).collect::()); [INFO] [stdout] 121 + [INFO] [stdout] 122 + // Record statistics for request conversion failure [INFO] [stdout] 123 + if let Some(ref key) = upstream_gemini_key { [INFO] [stdout] 124 + app_state.key_pool.mark_key_failure(key).await; [INFO] [stdout] 125 + app_state.stats.record_request( [INFO] [stdout] 126 + key, [INFO] [stdout] 127 + &target_model_id, [INFO] [stdout] 128 + &client_key_id, [INFO] [stdout] 129 + start_time.elapsed(), [INFO] [stdout] 130 + false, [INFO] [stdout] 131 + ); [INFO] [stdout] 132 + } [INFO] [stdout] 133 + [INFO] [stdout] 134 + return Err((StatusCode::BAD_REQUEST, format!("Request conversion failed: {}", e)).into_response()); [INFO] [stdout] 135 + } [INFO] [stdout] 136 + }; [INFO] [stdout] 137 + [INFO] [stdout] 138 + tracing::debug!("Request conversion successful, contents count: {}", gemini_request.contents.len()); [INFO] [stdout] 139 + [INFO] [stdout] 140 + // Perform upstream call [INFO] [stdout] 141 + let upstream_client = GeminiUpstreamClient::new(app_state.config.upstream.gemini.base_url.clone()); [INFO] [stdout] 142 + [INFO] [stdout] 143 + tracing::debug!("About to convert request for path: {}", uri_path); [INFO] [stdout] 144 + [INFO] [stdout] 145 ~ // 直接使用gemini_request,我们已经有了转换好的请求 [INFO] [stdout] 146 + tracing::debug!("About to call Gemini API, model: {}, contents count: {}, api_key: {}", target_model_id, gemini_request.contents.len(), mask_api_key(api_key)); [INFO] [stdout] 147 + tracing::debug!("API endpoint: {}", app_state.config.upstream.gemini.base_url); [INFO] [stdout] 148 + [INFO] [stdout] 149 + let upstream_response = upstream_client [INFO] [stdout] 150 + .generate_content( [INFO] [stdout] 151 + &target_model_id, [INFO] [stdout] 152 + api_key, [INFO] [stdout] 153 + &gemini_request, [INFO] [stdout] 154 + stream_response, [INFO] [stdout] 155 + ) [INFO] [stdout] 156 + .await; [INFO] [stdout] 157 + [INFO] [stdout] 158 + tracing::debug!("Gemini API call completed"); [INFO] [stdout] 159 + [INFO] [stdout] 160 + match upstream_response { [INFO] [stdout] 161 + Ok(res) => { [INFO] [stdout] 162 + let status = res.status().as_u16(); [INFO] [stdout] 163 + let success = status >= 200 && status < 300; [INFO] [stdout] 164 + tracing::debug!("Gemini API response status: {}, success: {}, api_key: {}", status, success, mask_api_key(api_key)); [INFO] [stdout] 165 + [INFO] [stdout] 166 + // Check for 403 error - move key to restricted list for this specific model [INFO] [stdout] 167 + if status == 403 { [INFO] [stdout] 168 + tracing::warn!("403 error detected for key {} on model {}, moving to restricted list", mask_api_key(api_key), target_model_id); [INFO] [stdout] 169 + app_state.key_pool.move_key_to_restricted(&upstream_gemini_key_id, &target_model_id).await; [INFO] [stdout] 170 + [INFO] [stdout] 171 + // Update key health for 403 error [INFO] [stdout] 172 + app_state.key_pool.mark_key_failure(&upstream_gemini_key_id).await; [INFO] [stdout] 173 + [INFO] [stdout] 174 + // Record statistics for 403 error [INFO] [stdout] 175 + app_state.stats.record_request( [INFO] [stdout] 176 + &upstream_gemini_key_id, [INFO] [stdout] 177 + &target_model_id, [INFO] [stdout] 178 + &client_key_id, [INFO] [stdout] 179 + start_time.elapsed(), [INFO] [stdout] 180 + false, // 403 is a failure [INFO] [stdout] 181 + ); [INFO] [stdout] 182 + [INFO] [stdout] 183 + // Try to read response body to get error details [INFO] [stdout] 184 + let error_content = if let Ok(res_bytes) = res.bytes().await { [INFO] [stdout] 185 + let response_str = String::from_utf8_lossy(&res_bytes); [INFO] [stdout] 186 + tracing::error!("403 Error details for model {}: {}", target_model_id, response_str); [INFO] [stdout] 187 + Some(response_str.to_string()) [INFO] [stdout] 188 + } else { [INFO] [stdout] 189 + None [INFO] [stdout] 190 + }; [INFO] [stdout] 191 + [INFO] [stdout] 192 ~ // 记录403错误日志 [INFO] [stdout] 193 + log_api_request( [INFO] [stdout] 194 + &app_state, [INFO] [stdout] 195 + &upstream_gemini_key_id, [INFO] [stdout] 196 + &target_model_id, [INFO] [stdout] 197 + 403, [INFO] [stdout] 198 + error_content, [INFO] [stdout] 199 + "403 Forbidden - API key temporarily unavailable", [INFO] [stdout] 200 + false, [INFO] [stdout] 201 + ).await; [INFO] [stdout] 202 + [INFO] [stdout] 203 + return Err((StatusCode::SERVICE_UNAVAILABLE, "API key temporarily unavailable (403 error)").into_response()); [INFO] [stdout] 204 + } [INFO] [stdout] 205 + [INFO] [stdout] 206 + // Update key health based on response [INFO] [stdout] 207 + if success { [INFO] [stdout] 208 + app_state.key_pool.mark_key_success(&upstream_gemini_key_id).await; [INFO] [stdout] 209 + } else if status >= 400 { [INFO] [stdout] 210 + app_state.key_pool.mark_key_failure(&upstream_gemini_key_id).await; [INFO] [stdout] 211 + } [INFO] [stdout] 212 + [INFO] [stdout] 213 + app_state.stats.record_request( [INFO] [stdout] 214 + &upstream_gemini_key_id, [INFO] [stdout] 215 + &target_model_id, [INFO] [stdout] 216 + &client_key_id, [INFO] [stdout] 217 + start_time.elapsed(), [INFO] [stdout] 218 + success, [INFO] [stdout] 219 + ); [INFO] [stdout] 220 + [INFO] [stdout] 221 + // Handle streaming responses separately [INFO] [stdout] 222 + if stream_response { [INFO] [stdout] 223 + match handle_streaming_response(res, uri_path.clone(), target_model_id).await { [INFO] [stdout] 224 + Ok(streaming_resp) => Ok(streaming_resp), [INFO] [stdout] 225 + Err(e) => { [INFO] [stdout] 226 + tracing::error!("Streaming response handling failed: {:?}", e); [INFO] [stdout] 227 + Err(e) [INFO] [stdout] 228 + } [INFO] [stdout] 229 + } [INFO] [stdout] 230 + } else { [INFO] [stdout] 231 + let res_bytes = res.bytes().await.map_err(|e| { [INFO] [stdout] 232 + tracing::error!("Failed to read response bytes: {}", e); [INFO] [stdout] 233 + (StatusCode::INTERNAL_SERVER_ERROR, format!("Response read error: {}", e)).into_response() [INFO] [stdout] 234 + })?; [INFO] [stdout] 235 + [INFO] [stdout] 236 + let response_str = String::from_utf8_lossy(&res_bytes); [INFO] [stdout] 237 + println!("=== GEMINI API RESPONSE START ==="); [INFO] [stdout] 238 + println!("Response length: {}", response_str.len()); [INFO] [stdout] 239 + println!("Raw response: {}", response_str); [INFO] [stdout] 240 + println!("=== GEMINI API RESPONSE END ==="); [INFO] [stdout] 241 + [INFO] [stdout] 242 + let gemini_response: GeminiResponse = match serde_json::from_slice::(&res_bytes) { [INFO] [stdout] 243 + Ok(response) => { [INFO] [stdout] 244 + tracing::debug!("Successfully parsed Gemini response, candidates count: {}", response.candidates.len()); [INFO] [stdout] 245 + response [INFO] [stdout] 246 + }, [INFO] [stdout] 247 + Err(e) => { [INFO] [stdout] 248 + eprintln!("=== GEMINI API PARSING ERROR ==="); [INFO] [stdout] 249 + eprintln!("Parse error: {}", e); [INFO] [stdout] 250 + eprintln!("Full response body: {}", response_str); [INFO] [stdout] 251 + eprintln!("=== ERROR END ==="); [INFO] [stdout] 252 + // Return empty response as fallback [INFO] [stdout] 253 + GeminiResponse { candidates: vec![] } [INFO] [stdout] 254 + } [INFO] [stdout] 255 + }; [INFO] [stdout] 256 + [INFO] [stdout] 257 ~ // 使用简化转换器将响应转换回原始格式 [INFO] [stdout] 258 + let target_format = if uri_path.starts_with("/openai/v1/") { [INFO] [stdout] 259 + crate::transformers::common::ApiFormat::OpenAI [INFO] [stdout] 260 + } else if uri_path.starts_with("/anthropic/v1/") { [INFO] [stdout] 261 + crate::transformers::common::ApiFormat::Anthropic [INFO] [stdout] 262 + } else if uri_path.starts_with("/v1beta/") { [INFO] [stdout] 263 + crate::transformers::common::ApiFormat::Gemini [INFO] [stdout] 264 + } else if uri_path.starts_with("/v1/") { [INFO] [stdout] 265 ~ // 检查是否是OpenAI兼容的端点 [INFO] [stdout] 266 + if uri_path.contains("/chat/completions") || uri_path.contains("/completions") || uri_path.contains("/embeddings") { [INFO] [stdout] 267 + crate::transformers::common::ApiFormat::OpenAI [INFO] [stdout] 268 + } else { [INFO] [stdout] 269 + crate::transformers::common::ApiFormat::Gemini [INFO] [stdout] 270 + } [INFO] [stdout] 271 + } else { [INFO] [stdout] 272 + crate::transformers::common::ApiFormat::Gemini [INFO] [stdout] 273 + }; [INFO] [stdout] 274 + [INFO] [stdout] 275 + let converted_response = SimpleTransformerFactory::convert_response(&gemini_response, target_format, &target_model_id) [INFO] [stdout] 276 + .map_err(|e| { [INFO] [stdout] 277 + tracing::error!("Failed to convert response: {}", e); [INFO] [stdout] 278 + (StatusCode::INTERNAL_SERVER_ERROR, format!("Response conversion failed: {}", e)).into_response() [INFO] [stdout] 279 + })?; [INFO] [stdout] 280 + [INFO] [stdout] 281 + let status_code = StatusCode::from_u16(status) [INFO] [stdout] 282 + .map_err(|_| (StatusCode::INTERNAL_SERVER_ERROR, "Invalid status code").into_response())?; [INFO] [stdout] 283 + [INFO] [stdout] 284 ~ // 记录成功的API请求日志 [INFO] [stdout] 285 + let response_content = serde_json::to_string_pretty(&converted_response).ok(); [INFO] [stdout] 286 + log_api_request( [INFO] [stdout] 287 + &app_state, [INFO] [stdout] 288 + &upstream_gemini_key_id, [INFO] [stdout] 289 + &target_model_id, [INFO] [stdout] 290 + status, [INFO] [stdout] 291 + response_content, [INFO] [stdout] 292 + &format!("Successfully processed {} request", if stream_response { "streaming" } else { "regular" }), [INFO] [stdout] 293 + true, [INFO] [stdout] 294 + ).await; [INFO] [stdout] 295 + [INFO] [stdout] 296 + Ok((status_code, Json(converted_response)).into_response()) [INFO] [stdout] 297 + } [INFO] [stdout] 298 + } [INFO] [stdout] 299 + Err(e) => { [INFO] [stdout] 300 + // Mark key as failed due to network/request error [INFO] [stdout] 301 + app_state.key_pool.mark_key_failure(&upstream_gemini_key_id).await; [INFO] [stdout] 302 + [INFO] [stdout] 303 + app_state.stats.record_request( [INFO] [stdout] 304 + &upstream_gemini_key_id, [INFO] [stdout] 305 + &target_model_id, [INFO] [stdout] 306 + &client_key_id, [INFO] [stdout] 307 + start_time.elapsed(), [INFO] [stdout] 308 + false, [INFO] [stdout] 309 + ); [INFO] [stdout] 310 + [INFO] [stdout] 311 ~ // 记录网络/请求错误日志 [INFO] [stdout] 312 + log_api_request( [INFO] [stdout] 313 + &app_state, [INFO] [stdout] 314 + &upstream_gemini_key_id, [INFO] [stdout] 315 + &target_model_id, [INFO] [stdout] 316 ~ 500, // 内部服务器错误 [INFO] [stdout] 317 + Some(format!("Network/Request error: {}", e)), [INFO] [stdout] 318 + "Upstream network or request error", [INFO] [stdout] 319 + false, [INFO] [stdout] 320 + ).await; [INFO] [stdout] 321 + [INFO] [stdout] 322 + Err((StatusCode::INTERNAL_SERVER_ERROR, format!("Upstream error: {}", e)).into_response()) [INFO] [stdout] 323 + } [INFO] [stdout] 324 + } [INFO] [stdout] 325 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual `Range::contains` implementation [INFO] [stdout] --> src/proxy.rs:161:31 [INFO] [stdout] | [INFO] [stdout] 161 | let success = status >= 200 && status < 300; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(200..300).contains(&status)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains [INFO] [stdout] = note: `#[warn(clippy::manual_range_contains)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/health_check.rs:42:28 [INFO] [stdout] | [INFO] [stdout] 42 | let should_check = key_health.is_healthy && [INFO] [stdout] | ____________________________^ [INFO] [stdout] 43 | | (now - key_health.last_check).num_minutes() >= 5 || [INFO] [stdout] 44 | | !key_health.is_healthy; [INFO] [stdout] | |__________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 42 - let should_check = key_health.is_healthy && [INFO] [stdout] 43 - (now - key_health.last_check).num_minutes() >= 5 || [INFO] [stdout] 44 - !key_health.is_healthy; [INFO] [stdout] 42 + let should_check = !(key_health.is_healthy && (now - key_health.last_check).num_minutes() < 5); [INFO] [stdout] | [INFO] [stdout] 42 - let should_check = key_health.is_healthy && [INFO] [stdout] 43 - (now - key_health.last_check).num_minutes() >= 5 || [INFO] [stdout] 44 - !key_health.is_healthy; [INFO] [stdout] 42 + let should_check = !key_health.is_healthy || (now - key_health.last_check).num_minutes() >= 5; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `QuotaResetService` [INFO] [stdout] --> src/services/quota_reset.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | / pub fn new() -> Self { [INFO] [stdout] 20 | | Self { [INFO] [stdout] 21 | | is_running: Arc::new(std::sync::atomic::AtomicBool::new(false)), [INFO] [stdout] 22 | | } [INFO] [stdout] 23 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] = note: `#[warn(clippy::new_without_default)]` on by default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 17 + impl Default for QuotaResetService { [INFO] [stdout] 18 + fn default() -> Self { [INFO] [stdout] 19 + Self::new() [INFO] [stdout] 20 + } [INFO] [stdout] 21 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `StatsManager` [INFO] [stdout] --> src/stats/manager.rs:66:5 [INFO] [stdout] | [INFO] [stdout] 66 | / pub fn new() -> Self { [INFO] [stdout] 67 | | Self { [INFO] [stdout] 68 | | global_stats: Arc::new(RwLock::new(GlobalStats::default())), [INFO] [stdout] 69 | | key_stats: Arc::new(RwLock::new(HashMap::new())), [INFO] [stdout] ... | [INFO] [stdout] 73 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 65 + impl Default for StatsManager { [INFO] [stdout] 66 + fn default() -> Self { [INFO] [stdout] 67 + Self::new() [INFO] [stdout] 68 + } [INFO] [stdout] 69 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `AuthManager` [INFO] [stdout] --> src/session_auth.rs:32:5 [INFO] [stdout] | [INFO] [stdout] 32 | / pub fn new() -> Self { [INFO] [stdout] 33 | | Self [INFO] [stdout] 34 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 31 + impl Default for AuthManager { [INFO] [stdout] 32 + fn default() -> Self { [INFO] [stdout] 33 + Self::new() [INFO] [stdout] 34 + } [INFO] [stdout] 35 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/session_auth.rs:60:21 [INFO] [stdout] | [INFO] [stdout] 60 | hex::encode(&token_bytes) [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `token_bytes` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/session_auth.rs:188:13 [INFO] [stdout] | [INFO] [stdout] 188 | / return Json(serde_json::json!({ [INFO] [stdout] 189 | | "success": true, [INFO] [stdout] 190 | | "message": "登录成功", [INFO] [stdout] 191 | | "must_change_password": user.must_change_password [INFO] [stdout] 192 | | })).into_response(); [INFO] [stdout] | |_______________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 188 ~ Json(serde_json::json!({ [INFO] [stdout] 189 + "success": true, [INFO] [stdout] 190 ~ "message": "登录成功", [INFO] [stdout] 191 + "must_change_password": user.must_change_password [INFO] [stdout] 192 ~ })).into_response() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/session_auth.rs:200:13 [INFO] [stdout] | [INFO] [stdout] 200 | return (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 200 - return (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response(); [INFO] [stdout] 200 + (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/session_auth.rs:131:9 [INFO] [stdout] | [INFO] [stdout] 131 | / if let Some(failure) = login_failures.get(username) { [INFO] [stdout] 132 | | if let Some(locked_until) = failure.locked_until { [INFO] [stdout] 133 | | if Utc::now() < locked_until { [INFO] [stdout] 134 | | return ( [INFO] [stdout] ... | [INFO] [stdout] 140 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 131 ~ if let Some(failure) = login_failures.get(username) [INFO] [stdout] 132 ~ && let Some(locked_until) = failure.locked_until { [INFO] [stdout] 133 | if Utc::now() < locked_until { [INFO] [stdout] ... [INFO] [stdout] 138 | } [INFO] [stdout] 139 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/session_auth.rs:132:13 [INFO] [stdout] | [INFO] [stdout] 132 | / if let Some(locked_until) = failure.locked_until { [INFO] [stdout] 133 | | if Utc::now() < locked_until { [INFO] [stdout] 134 | | return ( [INFO] [stdout] 135 | | StatusCode::TOO_MANY_REQUESTS, [INFO] [stdout] ... | [INFO] [stdout] 139 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 132 ~ if let Some(locked_until) = failure.locked_until [INFO] [stdout] 133 ~ && Utc::now() < locked_until { [INFO] [stdout] 134 | return ( [INFO] [stdout] ... [INFO] [stdout] 137 | ).into_response(); [INFO] [stdout] 138 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/session_auth.rs:282:17 [INFO] [stdout] | [INFO] [stdout] 282 | hex::encode(&token_bytes) [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `token_bytes` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/session_auth.rs:300:9 [INFO] [stdout] | [INFO] [stdout] 300 | / if let Some(header_value) = parts.headers.get("X-CSRF-Token") { [INFO] [stdout] 301 | | if let Ok(token_str) = header_value.to_str() { [INFO] [stdout] 302 | | return Ok(CsrfToken(token_str.to_string())); [INFO] [stdout] 303 | | } [INFO] [stdout] 304 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 300 ~ if let Some(header_value) = parts.headers.get("X-CSRF-Token") [INFO] [stdout] 301 ~ && let Ok(token_str) = header_value.to_str() { [INFO] [stdout] 302 | return Ok(CsrfToken(token_str.to_string())); [INFO] [stdout] 303 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:124:5 [INFO] [stdout] | [INFO] [stdout] 124 | / if let Some(candidates) = gemini_data.get("candidates").and_then(|c| c.as_array()) { [INFO] [stdout] 125 | | if let Some(candidate) = candidates.first() { [INFO] [stdout] 126 | | if let Some(content) = candidate.get("content") { [INFO] [stdout] 127 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] ... | [INFO] [stdout] 151 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 124 ~ if let Some(candidates) = gemini_data.get("candidates").and_then(|c| c.as_array()) [INFO] [stdout] 125 ~ && let Some(candidate) = candidates.first() { [INFO] [stdout] 126 | if let Some(content) = candidate.get("content") { [INFO] [stdout] ... [INFO] [stdout] 149 | } [INFO] [stdout] 150 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:125:9 [INFO] [stdout] | [INFO] [stdout] 125 | / if let Some(candidate) = candidates.first() { [INFO] [stdout] 126 | | if let Some(content) = candidate.get("content") { [INFO] [stdout] 127 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 128 | | if let Some(part) = parts.first() { [INFO] [stdout] ... | [INFO] [stdout] 150 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 125 ~ if let Some(candidate) = candidates.first() [INFO] [stdout] 126 ~ && let Some(content) = candidate.get("content") { [INFO] [stdout] 127 | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] ... [INFO] [stdout] 148 | } [INFO] [stdout] 149 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:126:13 [INFO] [stdout] | [INFO] [stdout] 126 | / if let Some(content) = candidate.get("content") { [INFO] [stdout] 127 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 128 | | if let Some(part) = parts.first() { [INFO] [stdout] 129 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... | [INFO] [stdout] 149 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 126 ~ if let Some(content) = candidate.get("content") [INFO] [stdout] 127 ~ && let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 128 | if let Some(part) = parts.first() { [INFO] [stdout] ... [INFO] [stdout] 147 | } [INFO] [stdout] 148 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:127:17 [INFO] [stdout] | [INFO] [stdout] 127 | / if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 128 | | if let Some(part) = parts.first() { [INFO] [stdout] 129 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... | [INFO] [stdout] 148 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 127 ~ if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) [INFO] [stdout] 128 ~ && let Some(part) = parts.first() { [INFO] [stdout] 129 | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... [INFO] [stdout] 146 | } [INFO] [stdout] 147 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:128:21 [INFO] [stdout] | [INFO] [stdout] 128 | / if let Some(part) = parts.first() { [INFO] [stdout] 129 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] 130 | | // 创建 OpenAI 格式的响应 [INFO] [stdout] 131 | | let openai_response = json!({ [INFO] [stdout] ... | [INFO] [stdout] 147 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 128 ~ if let Some(part) = parts.first() [INFO] [stdout] 129 ~ && let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] 130 | // 创建 OpenAI 格式的响应 [INFO] [stdout] ... [INFO] [stdout] 145 | return openai_response.to_string(); [INFO] [stdout] 146 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:160:5 [INFO] [stdout] | [INFO] [stdout] 160 | / if let Some(candidates) = gemini_data.get("candidates").and_then(|c| c.as_array()) { [INFO] [stdout] 161 | | if let Some(candidate) = candidates.first() { [INFO] [stdout] 162 | | if let Some(content) = candidate.get("content") { [INFO] [stdout] 163 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] ... | [INFO] [stdout] 182 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 160 ~ if let Some(candidates) = gemini_data.get("candidates").and_then(|c| c.as_array()) [INFO] [stdout] 161 ~ && let Some(candidate) = candidates.first() { [INFO] [stdout] 162 | if let Some(content) = candidate.get("content") { [INFO] [stdout] ... [INFO] [stdout] 180 | } [INFO] [stdout] 181 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:161:9 [INFO] [stdout] | [INFO] [stdout] 161 | / if let Some(candidate) = candidates.first() { [INFO] [stdout] 162 | | if let Some(content) = candidate.get("content") { [INFO] [stdout] 163 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 164 | | if let Some(part) = parts.first() { [INFO] [stdout] ... | [INFO] [stdout] 181 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 161 ~ if let Some(candidate) = candidates.first() [INFO] [stdout] 162 ~ && let Some(content) = candidate.get("content") { [INFO] [stdout] 163 | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] ... [INFO] [stdout] 179 | } [INFO] [stdout] 180 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:162:13 [INFO] [stdout] | [INFO] [stdout] 162 | / if let Some(content) = candidate.get("content") { [INFO] [stdout] 163 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 164 | | if let Some(part) = parts.first() { [INFO] [stdout] 165 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... | [INFO] [stdout] 180 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 162 ~ if let Some(content) = candidate.get("content") [INFO] [stdout] 163 ~ && let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 164 | if let Some(part) = parts.first() { [INFO] [stdout] ... [INFO] [stdout] 178 | } [INFO] [stdout] 179 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:163:17 [INFO] [stdout] | [INFO] [stdout] 163 | / if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 164 | | if let Some(part) = parts.first() { [INFO] [stdout] 165 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... | [INFO] [stdout] 179 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 163 ~ if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) [INFO] [stdout] 164 ~ && let Some(part) = parts.first() { [INFO] [stdout] 165 | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... [INFO] [stdout] 177 | } [INFO] [stdout] 178 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:164:21 [INFO] [stdout] | [INFO] [stdout] 164 | / if let Some(part) = parts.first() { [INFO] [stdout] 165 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] 166 | | // 创建 Anthropic 格式的响应 [INFO] [stdout] 167 | | let anthropic_response = json!({ [INFO] [stdout] ... | [INFO] [stdout] 178 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 164 ~ if let Some(part) = parts.first() [INFO] [stdout] 165 ~ && let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] 166 | // 创建 Anthropic 格式的响应 [INFO] [stdout] ... [INFO] [stdout] 176 | return anthropic_response.to_string(); [INFO] [stdout] 177 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/streaming.rs:192:9 [INFO] [stdout] | [INFO] [stdout] 192 | format!("data: [DONE]\n\n") [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"data: [DONE]\n\n".to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] = note: `#[warn(clippy::useless_format)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/streaming.rs:195:9 [INFO] [stdout] | [INFO] [stdout] 195 | format!("event: message_stop\ndata: {{\"type\": \"message_stop\"}}\n\n") [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"event: message_stop\ndata: {\"type\": \"message_stop\"}\n\n".to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/streaming.rs:198:9 [INFO] [stdout] | [INFO] [stdout] 198 | format!("data: {{\"candidates\": []}}\n\n") [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"data: {\"candidates\": []}\n\n".to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `StatsManager` [INFO] [stdout] --> src/stats/manager.rs:66:5 [INFO] [stdout] | [INFO] [stdout] 66 | / pub fn new() -> Self { [INFO] [stdout] 67 | | Self { [INFO] [stdout] 68 | | global_stats: Arc::new(RwLock::new(GlobalStats::default())), [INFO] [stdout] 69 | | key_stats: Arc::new(RwLock::new(HashMap::new())), [INFO] [stdout] ... | [INFO] [stdout] 73 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 65 + impl Default for StatsManager { [INFO] [stdout] 66 + fn default() -> Self { [INFO] [stdout] 67 + Self::new() [INFO] [stdout] 68 + } [INFO] [stdout] 69 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `AuthManager` [INFO] [stdout] --> src/session_auth.rs:32:5 [INFO] [stdout] | [INFO] [stdout] 32 | / pub fn new() -> Self { [INFO] [stdout] 33 | | Self [INFO] [stdout] 34 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 31 + impl Default for AuthManager { [INFO] [stdout] 32 + fn default() -> Self { [INFO] [stdout] 33 + Self::new() [INFO] [stdout] 34 + } [INFO] [stdout] 35 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/session_auth.rs:60:21 [INFO] [stdout] | [INFO] [stdout] 60 | hex::encode(&token_bytes) [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `token_bytes` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/session_auth.rs:188:13 [INFO] [stdout] | [INFO] [stdout] 188 | / return Json(serde_json::json!({ [INFO] [stdout] 189 | | "success": true, [INFO] [stdout] 190 | | "message": "登录成功", [INFO] [stdout] 191 | | "must_change_password": user.must_change_password [INFO] [stdout] 192 | | })).into_response(); [INFO] [stdout] | |_______________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 188 ~ Json(serde_json::json!({ [INFO] [stdout] 189 + "success": true, [INFO] [stdout] 190 ~ "message": "登录成功", [INFO] [stdout] 191 + "must_change_password": user.must_change_password [INFO] [stdout] 192 ~ })).into_response() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/session_auth.rs:200:13 [INFO] [stdout] | [INFO] [stdout] 200 | return (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 200 - return (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response(); [INFO] [stdout] 200 + (StatusCode::INTERNAL_SERVER_ERROR, "数据库查询失败").into_response() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/session_auth.rs:131:9 [INFO] [stdout] | [INFO] [stdout] 131 | / if let Some(failure) = login_failures.get(username) { [INFO] [stdout] 132 | | if let Some(locked_until) = failure.locked_until { [INFO] [stdout] 133 | | if Utc::now() < locked_until { [INFO] [stdout] 134 | | return ( [INFO] [stdout] ... | [INFO] [stdout] 140 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 131 ~ if let Some(failure) = login_failures.get(username) [INFO] [stdout] 132 ~ && let Some(locked_until) = failure.locked_until { [INFO] [stdout] 133 | if Utc::now() < locked_until { [INFO] [stdout] ... [INFO] [stdout] 138 | } [INFO] [stdout] 139 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/session_auth.rs:132:13 [INFO] [stdout] | [INFO] [stdout] 132 | / if let Some(locked_until) = failure.locked_until { [INFO] [stdout] 133 | | if Utc::now() < locked_until { [INFO] [stdout] 134 | | return ( [INFO] [stdout] 135 | | StatusCode::TOO_MANY_REQUESTS, [INFO] [stdout] ... | [INFO] [stdout] 139 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 132 ~ if let Some(locked_until) = failure.locked_until [INFO] [stdout] 133 ~ && Utc::now() < locked_until { [INFO] [stdout] 134 | return ( [INFO] [stdout] ... [INFO] [stdout] 137 | ).into_response(); [INFO] [stdout] 138 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/session_auth.rs:282:17 [INFO] [stdout] | [INFO] [stdout] 282 | hex::encode(&token_bytes) [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `token_bytes` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/session_auth.rs:300:9 [INFO] [stdout] | [INFO] [stdout] 300 | / if let Some(header_value) = parts.headers.get("X-CSRF-Token") { [INFO] [stdout] 301 | | if let Ok(token_str) = header_value.to_str() { [INFO] [stdout] 302 | | return Ok(CsrfToken(token_str.to_string())); [INFO] [stdout] 303 | | } [INFO] [stdout] 304 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 300 ~ if let Some(header_value) = parts.headers.get("X-CSRF-Token") [INFO] [stdout] 301 ~ && let Ok(token_str) = header_value.to_str() { [INFO] [stdout] 302 | return Ok(CsrfToken(token_str.to_string())); [INFO] [stdout] 303 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:124:5 [INFO] [stdout] | [INFO] [stdout] 124 | / if let Some(candidates) = gemini_data.get("candidates").and_then(|c| c.as_array()) { [INFO] [stdout] 125 | | if let Some(candidate) = candidates.first() { [INFO] [stdout] 126 | | if let Some(content) = candidate.get("content") { [INFO] [stdout] 127 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] ... | [INFO] [stdout] 151 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 124 ~ if let Some(candidates) = gemini_data.get("candidates").and_then(|c| c.as_array()) [INFO] [stdout] 125 ~ && let Some(candidate) = candidates.first() { [INFO] [stdout] 126 | if let Some(content) = candidate.get("content") { [INFO] [stdout] ... [INFO] [stdout] 149 | } [INFO] [stdout] 150 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:125:9 [INFO] [stdout] | [INFO] [stdout] 125 | / if let Some(candidate) = candidates.first() { [INFO] [stdout] 126 | | if let Some(content) = candidate.get("content") { [INFO] [stdout] 127 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 128 | | if let Some(part) = parts.first() { [INFO] [stdout] ... | [INFO] [stdout] 150 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 125 ~ if let Some(candidate) = candidates.first() [INFO] [stdout] 126 ~ && let Some(content) = candidate.get("content") { [INFO] [stdout] 127 | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] ... [INFO] [stdout] 148 | } [INFO] [stdout] 149 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:126:13 [INFO] [stdout] | [INFO] [stdout] 126 | / if let Some(content) = candidate.get("content") { [INFO] [stdout] 127 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 128 | | if let Some(part) = parts.first() { [INFO] [stdout] 129 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... | [INFO] [stdout] 149 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 126 ~ if let Some(content) = candidate.get("content") [INFO] [stdout] 127 ~ && let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 128 | if let Some(part) = parts.first() { [INFO] [stdout] ... [INFO] [stdout] 147 | } [INFO] [stdout] 148 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:127:17 [INFO] [stdout] | [INFO] [stdout] 127 | / if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 128 | | if let Some(part) = parts.first() { [INFO] [stdout] 129 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... | [INFO] [stdout] 148 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 127 ~ if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) [INFO] [stdout] 128 ~ && let Some(part) = parts.first() { [INFO] [stdout] 129 | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... [INFO] [stdout] 146 | } [INFO] [stdout] 147 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:128:21 [INFO] [stdout] | [INFO] [stdout] 128 | / if let Some(part) = parts.first() { [INFO] [stdout] 129 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] 130 | | // 创建 OpenAI 格式的响应 [INFO] [stdout] 131 | | let openai_response = json!({ [INFO] [stdout] ... | [INFO] [stdout] 147 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 128 ~ if let Some(part) = parts.first() [INFO] [stdout] 129 ~ && let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] 130 | // 创建 OpenAI 格式的响应 [INFO] [stdout] ... [INFO] [stdout] 145 | return openai_response.to_string(); [INFO] [stdout] 146 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:160:5 [INFO] [stdout] | [INFO] [stdout] 160 | / if let Some(candidates) = gemini_data.get("candidates").and_then(|c| c.as_array()) { [INFO] [stdout] 161 | | if let Some(candidate) = candidates.first() { [INFO] [stdout] 162 | | if let Some(content) = candidate.get("content") { [INFO] [stdout] 163 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] ... | [INFO] [stdout] 182 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 160 ~ if let Some(candidates) = gemini_data.get("candidates").and_then(|c| c.as_array()) [INFO] [stdout] 161 ~ && let Some(candidate) = candidates.first() { [INFO] [stdout] 162 | if let Some(content) = candidate.get("content") { [INFO] [stdout] ... [INFO] [stdout] 180 | } [INFO] [stdout] 181 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:161:9 [INFO] [stdout] | [INFO] [stdout] 161 | / if let Some(candidate) = candidates.first() { [INFO] [stdout] 162 | | if let Some(content) = candidate.get("content") { [INFO] [stdout] 163 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 164 | | if let Some(part) = parts.first() { [INFO] [stdout] ... | [INFO] [stdout] 181 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 161 ~ if let Some(candidate) = candidates.first() [INFO] [stdout] 162 ~ && let Some(content) = candidate.get("content") { [INFO] [stdout] 163 | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] ... [INFO] [stdout] 179 | } [INFO] [stdout] 180 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:162:13 [INFO] [stdout] | [INFO] [stdout] 162 | / if let Some(content) = candidate.get("content") { [INFO] [stdout] 163 | | if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 164 | | if let Some(part) = parts.first() { [INFO] [stdout] 165 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... | [INFO] [stdout] 180 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 162 ~ if let Some(content) = candidate.get("content") [INFO] [stdout] 163 ~ && let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 164 | if let Some(part) = parts.first() { [INFO] [stdout] ... [INFO] [stdout] 178 | } [INFO] [stdout] 179 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:163:17 [INFO] [stdout] | [INFO] [stdout] 163 | / if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) { [INFO] [stdout] 164 | | if let Some(part) = parts.first() { [INFO] [stdout] 165 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... | [INFO] [stdout] 179 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 163 ~ if let Some(parts) = content.get("parts").and_then(|p| p.as_array()) [INFO] [stdout] 164 ~ && let Some(part) = parts.first() { [INFO] [stdout] 165 | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] ... [INFO] [stdout] 177 | } [INFO] [stdout] 178 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/streaming.rs:164:21 [INFO] [stdout] | [INFO] [stdout] 164 | / if let Some(part) = parts.first() { [INFO] [stdout] 165 | | if let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] 166 | | // 创建 Anthropic 格式的响应 [INFO] [stdout] 167 | | let anthropic_response = json!({ [INFO] [stdout] ... | [INFO] [stdout] 178 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 164 ~ if let Some(part) = parts.first() [INFO] [stdout] 165 ~ && let Some(text) = part.get("text").and_then(|t| t.as_str()) { [INFO] [stdout] 166 | // 创建 Anthropic 格式的响应 [INFO] [stdout] ... [INFO] [stdout] 176 | return anthropic_response.to_string(); [INFO] [stdout] 177 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/streaming.rs:192:9 [INFO] [stdout] | [INFO] [stdout] 192 | format!("data: [DONE]\n\n") [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"data: [DONE]\n\n".to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] = note: `#[warn(clippy::useless_format)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/streaming.rs:195:9 [INFO] [stdout] | [INFO] [stdout] 195 | format!("event: message_stop\ndata: {{\"type\": \"message_stop\"}}\n\n") [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"event: message_stop\ndata: {\"type\": \"message_stop\"}\n\n".to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/streaming.rs:198:9 [INFO] [stdout] | [INFO] [stdout] 198 | format!("data: {{\"candidates\": []}}\n\n") [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"data: {\"candidates\": []}\n\n".to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/connection.rs:82:22 [INFO] [stdout] | [INFO] [stdout] 82 | .map_err(|e| crate::database::DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `crate::database::DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] = note: `#[warn(clippy::redundant_closure)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:22:18 [INFO] [stdout] | [INFO] [stdout] 22 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:35:18 [INFO] [stdout] | [INFO] [stdout] 35 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:105:18 [INFO] [stdout] | [INFO] [stdout] 105 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:133:18 [INFO] [stdout] | [INFO] [stdout] 133 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:146:18 [INFO] [stdout] | [INFO] [stdout] 146 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:22:18 [INFO] [stdout] | [INFO] [stdout] 22 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:35:18 [INFO] [stdout] | [INFO] [stdout] 35 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:48:18 [INFO] [stdout] | [INFO] [stdout] 48 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:61:18 [INFO] [stdout] | [INFO] [stdout] 61 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:132:18 [INFO] [stdout] | [INFO] [stdout] 132 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:145:18 [INFO] [stdout] | [INFO] [stdout] 145 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:158:18 [INFO] [stdout] | [INFO] [stdout] 158 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:171:18 [INFO] [stdout] | [INFO] [stdout] 171 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:184:18 [INFO] [stdout] | [INFO] [stdout] 184 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:202:18 [INFO] [stdout] | [INFO] [stdout] 202 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:214:18 [INFO] [stdout] | [INFO] [stdout] 214 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:22:18 [INFO] [stdout] | [INFO] [stdout] 22 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:35:18 [INFO] [stdout] | [INFO] [stdout] 35 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:48:18 [INFO] [stdout] | [INFO] [stdout] 48 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:99:18 [INFO] [stdout] | [INFO] [stdout] 99 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:112:18 [INFO] [stdout] | [INFO] [stdout] 112 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:126:18 [INFO] [stdout] | [INFO] [stdout] 126 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:136:18 [INFO] [stdout] | [INFO] [stdout] 136 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:22:18 [INFO] [stdout] | [INFO] [stdout] 22 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:35:18 [INFO] [stdout] | [INFO] [stdout] 35 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:48:18 [INFO] [stdout] | [INFO] [stdout] 48 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:128:18 [INFO] [stdout] | [INFO] [stdout] 128 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:141:18 [INFO] [stdout] | [INFO] [stdout] 141 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:169:18 [INFO] [stdout] | [INFO] [stdout] 169 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:173:58 [INFO] [stdout] | [INFO] [stdout] 173 | let mut tx = self.pool.begin().await.map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:183:22 [INFO] [stdout] | [INFO] [stdout] 183 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:193:22 [INFO] [stdout] | [INFO] [stdout] 193 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:195:39 [INFO] [stdout] | [INFO] [stdout] 195 | tx.commit().await.map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:210:18 [INFO] [stdout] | [INFO] [stdout] 210 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:238:18 [INFO] [stdout] | [INFO] [stdout] 238 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:257:18 [INFO] [stdout] | [INFO] [stdout] 257 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:273:18 [INFO] [stdout] | [INFO] [stdout] 273 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:293:26 [INFO] [stdout] | [INFO] [stdout] 293 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_ok()` [INFO] [stdout] --> src/database/repositories/model.rs:306:28 [INFO] [stdout] | [INFO] [stdout] 306 | if let Ok(_) = self.create(create_data).await { [INFO] [stdout] | -------^^^^^--------------------------------- help: try: `if self.create(create_data).await.is_ok()` [INFO] [stdout] | [INFO] [stdout] = note: this will change drop order of the result, as well as all temporaries [INFO] [stdout] = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] = note: `#[warn(clippy::redundant_pattern_matching)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:331:22 [INFO] [stdout] | [INFO] [stdout] 331 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:36:18 [INFO] [stdout] | [INFO] [stdout] 36 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:51:18 [INFO] [stdout] | [INFO] [stdout] 51 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:73:18 [INFO] [stdout] | [INFO] [stdout] 73 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:96:18 [INFO] [stdout] | [INFO] [stdout] 96 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:118:18 [INFO] [stdout] | [INFO] [stdout] 118 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:139:18 [INFO] [stdout] | [INFO] [stdout] 139 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:172:18 [INFO] [stdout] | [INFO] [stdout] 172 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:24:18 [INFO] [stdout] | [INFO] [stdout] 24 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:37:18 [INFO] [stdout] | [INFO] [stdout] 37 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:76:18 [INFO] [stdout] | [INFO] [stdout] 76 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:95:18 [INFO] [stdout] | [INFO] [stdout] 95 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:113:18 [INFO] [stdout] | [INFO] [stdout] 113 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:134:18 [INFO] [stdout] | [INFO] [stdout] 134 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/database/repositories/user.rs:141:9 [INFO] [stdout] | [INFO] [stdout] 141 | / if let Some(user) = self.get_by_username(username).await? { [INFO] [stdout] 142 | | if let Some(locked_until) = user.locked_until { [INFO] [stdout] 143 | | return Ok(locked_until > chrono::Utc::now()); [INFO] [stdout] 144 | | } [INFO] [stdout] 145 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 141 ~ if let Some(user) = self.get_by_username(username).await? [INFO] [stdout] 142 ~ && let Some(locked_until) = user.locked_until { [INFO] [stdout] 143 | return Ok(locked_until > chrono::Utc::now()); [INFO] [stdout] 144 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:165:18 [INFO] [stdout] | [INFO] [stdout] 165 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:178:18 [INFO] [stdout] | [INFO] [stdout] 178 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:224:18 [INFO] [stdout] | [INFO] [stdout] 224 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:243:18 [INFO] [stdout] | [INFO] [stdout] 243 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:256:18 [INFO] [stdout] | [INFO] [stdout] 256 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/ip_lockout.rs:26:18 [INFO] [stdout] | [INFO] [stdout] 26 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/ip_lockout.rs:47:18 [INFO] [stdout] | [INFO] [stdout] 47 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/ip_lockout.rs:60:18 [INFO] [stdout] | [INFO] [stdout] 60 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_log.rs:30:18 [INFO] [stdout] | [INFO] [stdout] 30 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_log.rs:43:18 [INFO] [stdout] | [INFO] [stdout] 43 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_log.rs:58:18 [INFO] [stdout] | [INFO] [stdout] 58 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: enclosing `Ok` and `?` operator are unneeded [INFO] [stdout] --> src/database_integration.rs:43:5 [INFO] [stdout] | [INFO] [stdout] 43 | Ok(crate::state::AppState::new(db, memory_log, config).await?) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark [INFO] [stdout] = note: `#[warn(clippy::needless_question_mark)]` on by default [INFO] [stdout] help: remove the enclosing `Ok` and `?` operator [INFO] [stdout] | [INFO] [stdout] 43 - Ok(crate::state::AppState::new(db, memory_log, config).await?) [INFO] [stdout] 43 + crate::state::AppState::new(db, memory_log, config).await [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/connection.rs:82:22 [INFO] [stdout] | [INFO] [stdout] 82 | .map_err(|e| crate::database::DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `crate::database::DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] = note: `#[warn(clippy::redundant_closure)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:22:18 [INFO] [stdout] | [INFO] [stdout] 22 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:35:18 [INFO] [stdout] | [INFO] [stdout] 35 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:105:18 [INFO] [stdout] | [INFO] [stdout] 105 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:133:18 [INFO] [stdout] | [INFO] [stdout] 133 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_config.rs:146:18 [INFO] [stdout] | [INFO] [stdout] 146 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:22:18 [INFO] [stdout] | [INFO] [stdout] 22 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:35:18 [INFO] [stdout] | [INFO] [stdout] 35 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:48:18 [INFO] [stdout] | [INFO] [stdout] 48 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:61:18 [INFO] [stdout] | [INFO] [stdout] 61 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:132:18 [INFO] [stdout] | [INFO] [stdout] 132 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:145:18 [INFO] [stdout] | [INFO] [stdout] 145 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:158:18 [INFO] [stdout] | [INFO] [stdout] 158 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:171:18 [INFO] [stdout] | [INFO] [stdout] 171 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:184:18 [INFO] [stdout] | [INFO] [stdout] 184 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:202:18 [INFO] [stdout] | [INFO] [stdout] 202 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/api_key.rs:214:18 [INFO] [stdout] | [INFO] [stdout] 214 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:22:18 [INFO] [stdout] | [INFO] [stdout] 22 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:35:18 [INFO] [stdout] | [INFO] [stdout] 35 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:48:18 [INFO] [stdout] | [INFO] [stdout] 48 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:99:18 [INFO] [stdout] | [INFO] [stdout] 99 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:112:18 [INFO] [stdout] | [INFO] [stdout] 112 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:126:18 [INFO] [stdout] | [INFO] [stdout] 126 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_category.rs:136:18 [INFO] [stdout] | [INFO] [stdout] 136 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:22:18 [INFO] [stdout] | [INFO] [stdout] 22 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:35:18 [INFO] [stdout] | [INFO] [stdout] 35 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/security.rs:72:5 [INFO] [stdout] | [INFO] [stdout] 72 | / vec![ [INFO] [stdout] 73 | | "default-src 'self'", [INFO] [stdout] 74 | | "script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net", // 允许内联脚本和CDN [INFO] [stdout] 75 | | "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com", // 允许内联样式和Google Fonts [INFO] [stdout] ... | [INFO] [stdout] 81 | | "form-action 'self'", // 限制表单提交 [INFO] [stdout] 82 | | ] [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] = note: `#[warn(clippy::useless_vec)]` on by default [INFO] [stdout] help: you can use an array directly [INFO] [stdout] | [INFO] [stdout] 72 ~ ["default-src 'self'", [INFO] [stdout] 73 ~ "script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net", // 允许内联脚本和CDN [INFO] [stdout] 74 ~ "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com", // 允许内联样式和Google Fonts [INFO] [stdout] 75 ~ "font-src 'self' https://fonts.gstatic.com", // 允许Google Fonts [INFO] [stdout] 76 ~ "img-src 'self' data: https:", // 允许图片和数据URL [INFO] [stdout] 77 ~ "connect-src 'self'", // 限制连接源 [INFO] [stdout] 78 ~ "frame-ancestors 'none'", // 禁止嵌入 [INFO] [stdout] 79 ~ "base-uri 'self'", // 限制base标签 [INFO] [stdout] 80 + "form-action 'self'"] [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:48:18 [INFO] [stdout] | [INFO] [stdout] 48 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:128:18 [INFO] [stdout] | [INFO] [stdout] 128 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:141:18 [INFO] [stdout] | [INFO] [stdout] 141 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:169:18 [INFO] [stdout] | [INFO] [stdout] 169 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:173:58 [INFO] [stdout] | [INFO] [stdout] 173 | let mut tx = self.pool.begin().await.map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:183:22 [INFO] [stdout] | [INFO] [stdout] 183 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:193:22 [INFO] [stdout] | [INFO] [stdout] 193 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:195:39 [INFO] [stdout] | [INFO] [stdout] 195 | tx.commit().await.map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:210:18 [INFO] [stdout] | [INFO] [stdout] 210 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:238:18 [INFO] [stdout] | [INFO] [stdout] 238 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:257:18 [INFO] [stdout] | [INFO] [stdout] 257 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:273:18 [INFO] [stdout] | [INFO] [stdout] 273 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:293:26 [INFO] [stdout] | [INFO] [stdout] 293 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_ok()` [INFO] [stdout] --> src/database/repositories/model.rs:306:28 [INFO] [stdout] | [INFO] [stdout] 306 | if let Ok(_) = self.create(create_data).await { [INFO] [stdout] | -------^^^^^--------------------------------- help: try: `if self.create(create_data).await.is_ok()` [INFO] [stdout] | [INFO] [stdout] = note: this will change drop order of the result, as well as all temporaries [INFO] [stdout] = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] = note: `#[warn(clippy::redundant_pattern_matching)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model.rs:331:22 [INFO] [stdout] | [INFO] [stdout] 331 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:36:18 [INFO] [stdout] | [INFO] [stdout] 36 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:51:18 [INFO] [stdout] | [INFO] [stdout] 51 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:73:18 [INFO] [stdout] | [INFO] [stdout] 73 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:96:18 [INFO] [stdout] | [INFO] [stdout] 96 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:118:18 [INFO] [stdout] | [INFO] [stdout] 118 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:139:18 [INFO] [stdout] | [INFO] [stdout] 139 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/model_usage.rs:172:18 [INFO] [stdout] | [INFO] [stdout] 172 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:24:18 [INFO] [stdout] | [INFO] [stdout] 24 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:37:18 [INFO] [stdout] | [INFO] [stdout] 37 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:76:18 [INFO] [stdout] | [INFO] [stdout] 76 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:95:18 [INFO] [stdout] | [INFO] [stdout] 95 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:113:18 [INFO] [stdout] | [INFO] [stdout] 113 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:134:18 [INFO] [stdout] | [INFO] [stdout] 134 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/database/repositories/user.rs:141:9 [INFO] [stdout] | [INFO] [stdout] 141 | / if let Some(user) = self.get_by_username(username).await? { [INFO] [stdout] 142 | | if let Some(locked_until) = user.locked_until { [INFO] [stdout] 143 | | return Ok(locked_until > chrono::Utc::now()); [INFO] [stdout] 144 | | } [INFO] [stdout] 145 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 141 ~ if let Some(user) = self.get_by_username(username).await? [INFO] [stdout] 142 ~ && let Some(locked_until) = user.locked_until { [INFO] [stdout] 143 | return Ok(locked_until > chrono::Utc::now()); [INFO] [stdout] 144 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:165:18 [INFO] [stdout] | [INFO] [stdout] 165 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:178:18 [INFO] [stdout] | [INFO] [stdout] 178 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:224:18 [INFO] [stdout] | [INFO] [stdout] 224 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:243:18 [INFO] [stdout] | [INFO] [stdout] 243 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/user.rs:256:18 [INFO] [stdout] | [INFO] [stdout] 256 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/ip_lockout.rs:26:18 [INFO] [stdout] | [INFO] [stdout] 26 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/ip_lockout.rs:47:18 [INFO] [stdout] | [INFO] [stdout] 47 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/ip_lockout.rs:60:18 [INFO] [stdout] | [INFO] [stdout] 60 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_log.rs:30:18 [INFO] [stdout] | [INFO] [stdout] 30 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_log.rs:43:18 [INFO] [stdout] | [INFO] [stdout] 43 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/database/repositories/system_log.rs:58:18 [INFO] [stdout] | [INFO] [stdout] 58 | .map_err(|e| DatabaseError::Connection(e))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the tuple variant itself: `DatabaseError::Connection` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: enclosing `Ok` and `?` operator are unneeded [INFO] [stdout] --> src/database_integration.rs:43:5 [INFO] [stdout] | [INFO] [stdout] 43 | Ok(crate::state::AppState::new(db, memory_log, config).await?) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark [INFO] [stdout] = note: `#[warn(clippy::needless_question_mark)]` on by default [INFO] [stdout] help: remove the enclosing `Ok` and `?` operator [INFO] [stdout] | [INFO] [stdout] 43 - Ok(crate::state::AppState::new(db, memory_log, config).await?) [INFO] [stdout] 43 + crate::state::AppState::new(db, memory_log, config).await [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/security.rs:72:5 [INFO] [stdout] | [INFO] [stdout] 72 | / vec![ [INFO] [stdout] 73 | | "default-src 'self'", [INFO] [stdout] 74 | | "script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net", // 允许内联脚本和CDN [INFO] [stdout] 75 | | "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com", // 允许内联样式和Google Fonts [INFO] [stdout] ... | [INFO] [stdout] 81 | | "form-action 'self'", // 限制表单提交 [INFO] [stdout] 82 | | ] [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] = note: `#[warn(clippy::useless_vec)]` on by default [INFO] [stdout] help: you can use an array directly [INFO] [stdout] | [INFO] [stdout] 72 ~ ["default-src 'self'", [INFO] [stdout] 73 ~ "script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net", // 允许内联脚本和CDN [INFO] [stdout] 74 ~ "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com", // 允许内联样式和Google Fonts [INFO] [stdout] 75 ~ "font-src 'self' https://fonts.gstatic.com", // 允许Google Fonts [INFO] [stdout] 76 ~ "img-src 'self' data: https:", // 允许图片和数据URL [INFO] [stdout] 77 ~ "connect-src 'self'", // 限制连接源 [INFO] [stdout] 78 ~ "frame-ancestors 'none'", // 禁止嵌入 [INFO] [stdout] 79 ~ "base-uri 'self'", // 限制base标签 [INFO] [stdout] 80 + "form-action 'self'"] [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 48s [INFO] running `Command { std: "docker" "inspect" "4576744f2d0412b35a48f52fc8f3cc47054c86c42e29e68357d4a9a95091b9ea", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "4576744f2d0412b35a48f52fc8f3cc47054c86c42e29e68357d4a9a95091b9ea", kill_on_drop: false }` [INFO] [stdout] 4576744f2d0412b35a48f52fc8f3cc47054c86c42e29e68357d4a9a95091b9ea