From 07835e0fec0a0ca6b60cd99d5edae69689a96f6d Mon Sep 17 00:00:00 2001 From: Lucas Clemente Vella Date: Thu, 8 Feb 2024 18:47:02 +0000 Subject: [PATCH] Updating rust version from 1.72 to 1.74. --- .github/workflows/nightly-tests.yml | 4 ++-- .github/workflows/pr-tests.yml | 12 ++++++------ ast/src/asm_analysis/mod.rs | 13 ++++++------- cli/src/main.rs | 2 +- executor/src/witgen/mod.rs | 6 ++---- executor/src/witgen/sequence_iterator.rs | 2 +- pilopt/src/lib.rs | 6 ++++-- pipeline/build.rs | 2 +- riscv/build.rs | 2 +- rust-toolchain.toml | 2 +- 10 files changed, 25 insertions(+), 26 deletions(-) diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml index 82b4eb79d..98d4cba68 100644 --- a/.github/workflows/nightly-tests.yml +++ b/.github/workflows/nightly-tests.yml @@ -63,8 +63,8 @@ jobs: path: | ~/pilcom/node_modules key: ${{ runner.os }}-pilcom-node-modules - - name: Install Rust toolchain 1.72 - run: rustup toolchain install 1.72-x86_64-unknown-linux-gnu + - name: Install Rust toolchain 1.74 + run: rustup toolchain install 1.74-x86_64-unknown-linux-gnu - name: Install nightly run: rustup toolchain install nightly-2023-01-03-x86_64-unknown-linux-gnu - name: Install riscv target diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 21e36ccc9..f9e817acd 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -36,8 +36,8 @@ jobs: path: | ~/pilcom/node_modules key: ${{ runner.os }}-pilcom-node-modules - - name: Install Rust toolchain 1.72 (with clippy and rustfmt) - run: rustup toolchain install 1.72-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.72-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.72-x86_64-unknown-linux-gnu + - name: Install Rust toolchain 1.74 (with clippy and rustfmt) + run: rustup toolchain install 1.74-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.74-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.74-x86_64-unknown-linux-gnu - name: Lint run: cargo clippy --all --all-targets --all-features --profile pr-tests -- -D warnings - name: Lint @@ -84,8 +84,8 @@ jobs: path: | ~/pilcom/node_modules key: ${{ runner.os }}-pilcom-node-modules - - name: Install Rust toolchain 1.72 (with clippy and rustfmt) - run: rustup toolchain install 1.72-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.72-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.72-x86_64-unknown-linux-gnu + - name: Install Rust toolchain 1.74 (with clippy and rustfmt) + run: rustup toolchain install 1.74-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.74-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.74-x86_64-unknown-linux-gnu - name: Install nightly run: rustup toolchain install nightly-2023-01-03-x86_64-unknown-linux-gnu - name: Install riscv target @@ -121,8 +121,8 @@ jobs: path: | ~/pilcom/node_modules key: ${{ runner.os }}-pilcom-node-modules - - name: Install Rust toolchain 1.72 (with clippy and rustfmt) - run: rustup toolchain install 1.72-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.72-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.72-x86_64-unknown-linux-gnu + - name: Install Rust toolchain 1.74 (with clippy and rustfmt) + run: rustup toolchain install 1.74-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.74-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.74-x86_64-unknown-linux-gnu - name: Install nightly run: rustup toolchain install nightly-2023-01-03-x86_64-unknown-linux-gnu - name: Install riscv target diff --git a/ast/src/asm_analysis/mod.rs b/ast/src/asm_analysis/mod.rs index 3faa262d5..e222ad714 100644 --- a/ast/src/asm_analysis/mod.rs +++ b/ast/src/asm_analysis/mod.rs @@ -723,25 +723,24 @@ impl Machine { pub fn write_register_names(&self) -> impl Iterator { self.registers .iter() - .filter_map(|r: &RegisterDeclarationStatement| r.ty.is_write().then(|| r.name.as_ref())) + .filter(|r| r.ty.is_write()) + .map(|r| r.name.as_ref()) } /// Returns an iterator over references to the names of the assignment registers pub fn assignment_register_names(&self) -> impl Iterator { self.registers .iter() - .filter_map(|r: &RegisterDeclarationStatement| { - r.ty.is_assignment().then(|| r.name.as_ref()) - }) + .filter(|r| r.ty.is_assignment()) + .map(|r| r.name.as_ref()) } /// Returns an iterator over references to the names of the read-only registers pub fn read_only_register_names(&self) -> impl Iterator { self.registers .iter() - .filter_map(|r: &RegisterDeclarationStatement| { - r.ty.is_read_only().then(|| r.name.as_ref()) - }) + .filter(|r| r.ty.is_read_only()) + .map(|r| r.name.as_ref()) } /// Returns an iterator over references to the operation definitions diff --git a/cli/src/main.rs b/cli/src/main.rs index a5ccb855c..b99d78d36 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -35,7 +35,7 @@ fn bind_cli_args( let mut csv_writer = BufReader::new(&csv_file); read_polys_csv_file::(&mut csv_writer) }) - .unwrap_or(vec![]); + .unwrap_or_default(); let csv_mode = match csv_mode { CsvRenderModeCLI::SignedBase10 => CsvRenderMode::SignedBase10, diff --git a/executor/src/witgen/mod.rs b/executor/src/witgen/mod.rs index e019996c9..16cdfa9ae 100644 --- a/executor/src/witgen/mod.rs +++ b/executor/src/witgen/mod.rs @@ -242,10 +242,8 @@ impl<'a, T: FieldElement> FixedData<'a, T> { column_by_name: analyzed .definitions .iter() - .filter_map(|(name, (symbol, _))| { - matches!(symbol.kind, SymbolKind::Poly(_)) - .then(|| (name.clone(), symbol.into())) - }) + .filter(|(_, (symbol, _))| matches!(symbol.kind, SymbolKind::Poly(_))) + .map(|(name, (symbol, _))| (name.clone(), symbol.into())) .collect(), } } diff --git a/executor/src/witgen/sequence_iterator.rs b/executor/src/witgen/sequence_iterator.rs index 5c8617d67..8c7ed2c15 100644 --- a/executor/src/witgen/sequence_iterator.rs +++ b/executor/src/witgen/sequence_iterator.rs @@ -254,7 +254,7 @@ impl ProcessingSequenceCache { K: Copy + Ord, T: FieldElement, { - self.cache.entry(left.into()).or_insert(vec![]); + self.cache.entry(left.into()).or_default(); } pub fn report_processing_sequence( diff --git a/pilopt/src/lib.rs b/pilopt/src/lib.rs index 0a4642ee6..7735a02e1 100644 --- a/pilopt/src/lib.rs +++ b/pilopt/src/lib.rs @@ -242,14 +242,16 @@ fn remove_constant_witness_columns(pil_file: &mut Analyzed) let mut constant_polys = pil_file .identities .iter() - .filter_map(|id| (id.kind == IdentityKind::Polynomial).then(|| id.expression_for_poly_id())) + .filter(|&id| (id.kind == IdentityKind::Polynomial)) + .map(|id| id.expression_for_poly_id()) .filter_map(constrained_to_constant) .collect::>(); // We cannot remove arrays or array elements, so filter them out. let columns = pil_file .committed_polys_in_source_order() .iter() - .filter_map(|(s, _)| (!s.is_array()).then(|| s.into())) + .filter(|&(s, _)| (!s.is_array())) + .map(|(s, _)| s.into()) .collect::>(); constant_polys.retain(|id, _| columns.contains(id)); diff --git a/pipeline/build.rs b/pipeline/build.rs index c3430a155..4a5ca9057 100644 --- a/pipeline/build.rs +++ b/pipeline/build.rs @@ -14,7 +14,7 @@ fn main() { fn build_book_tests(kind: &str) { let out_dir = env::var("OUT_DIR").unwrap(); let destination = Path::new(&out_dir).join(format!("{kind}_book_tests.rs")); - let mut test_file = File::create(&destination).unwrap(); + let mut test_file = File::create(destination).unwrap(); let dir = format!("../test_data/{kind}/book/"); for file in WalkDir::new(&dir) { diff --git a/riscv/build.rs b/riscv/build.rs index 9c77b2485..da0ba35f7 100644 --- a/riscv/build.rs +++ b/riscv/build.rs @@ -22,7 +22,7 @@ fn build_lalrpop() { fn build_instruction_tests() { let out_dir = env::var("OUT_DIR").unwrap(); let destination = Path::new(&out_dir).join("instruction_tests.rs"); - let mut test_file = File::create(&destination).unwrap(); + let mut test_file = File::create(destination).unwrap(); let generated_path = "./tests/instruction_tests/generated"; println!("cargo:rerun-if-changed={generated_path}"); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7e8f0a9aa..71326c3d7 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.72" +channel = "1.74"