diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b52fe1c4c..4ca6c1c35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.43.1 + toolchain: 1.45.0 override: true - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.43.1 + toolchain: 1.45.0 components: clippy override: true - uses: actions-rs/clippy-check@v1 @@ -46,7 +46,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - rust: [nightly, 1.43.1] + rust: [nightly, 1.45.0] steps: - uses: actions/checkout@master diff --git a/ci_scripts/docker-coredeps/deps/build_rust.sh b/ci_scripts/docker-coredeps/deps/build_rust.sh index 72d3e599d..962737e1c 100755 --- a/ci_scripts/docker-coredeps/deps/build_rust.sh +++ b/ci_scripts/docker-coredeps/deps/build_rust.sh @@ -3,9 +3,9 @@ set -e -x # Install Rust -curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.43.1-x86_64-unknown-linux-gnu -y +curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.45.0-x86_64-unknown-linux-gnu -y export PATH=/root/.cargo/bin:$PATH rustc --version # remove some 300-400 MB that we don't need for automated builds -rm -rf /root/.rustup/toolchains/1.43.1-x86_64-unknown-linux-gnu/share +rm -rf /root/.rustup/toolchains/1.45.0-x86_64-unknown-linux-gnu/share diff --git a/rust-toolchain b/rust-toolchain index 3987c4729..50aceaa7b 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.43.1 +1.45.0 diff --git a/src/lib.rs b/src/lib.rs index dd968c2aa..db5e598fa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ clippy::all, clippy::indexing_slicing )] -#![allow(clippy::match_bool)] +#![allow(clippy::match_bool, clippy::eval_order_dependence)] #[macro_use] extern crate num_derive; diff --git a/src/simplify.rs b/src/simplify.rs index f2b4f0cc0..98c66a74e 100644 --- a/src/simplify.rs +++ b/src/simplify.rs @@ -6,10 +6,9 @@ // this escapes a bit more than actually needed by delta (eg. also lines as "-- footer"), // but for non-delta-compatibility, that seems to be better. // (to be only compatible with delta, only "[\r\n|\n]-- {0,2}[\r\n|\n]" needs to be replaced) -#[allow(clippy::indexing_slicing)] pub fn escape_message_footer_marks(text: &str) -> String { - if text.starts_with("--") { - "-\u{200B}-".to_string() + &text[2..].replace("\n--", "\n-\u{200B}-") + if let Some(text) = text.strip_prefix("--") { + "-\u{200B}-".to_string() + &text.replace("\n--", "\n-\u{200B}-") } else { text.replace("\n--", "\n-\u{200B}-") } diff --git a/src/sql.rs b/src/sql.rs index 5cc708bd5..3af1df87f 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -601,13 +601,10 @@ fn is_file_in_use(files_in_use: &HashSet, namespc_opt: Option<&str>, nam files_in_use.contains(name_to_check) } -#[allow(clippy::indexing_slicing)] // TODO: use str.strip_prefix once it is released in stable fn maybe_add_file(files_in_use: &mut HashSet, file: impl AsRef) { - if !file.as_ref().starts_with("$BLOBDIR/") { - return; + if let Some(file) = file.as_ref().strip_prefix("$BLOBDIR/") { + files_in_use.insert(file.to_string()); } - - files_in_use.insert(file.as_ref()[9..].into()); } async fn maybe_add_from_param(