diff --git a/.github/workflows/rust-test-with-style.yml b/.github/workflows/rust-test-with-style.yml index 80ea4a4dbf..63ce2d7b3c 100644 --- a/.github/workflows/rust-test-with-style.yml +++ b/.github/workflows/rust-test-with-style.yml @@ -32,7 +32,7 @@ jobs: env: CC: ${{ matrix.compiler }} FC: gfortran - run: cargo llvm-cov test --doctests --lcov --output-path lcov.info + run: CARGO_CEED_OPT_FLAGS="-g -O0 -fno-inline" cargo llvm-cov test --doctests --lcov --output-path lcov.info - name: Codecov upload uses: codecov/codecov-action@v4 with: diff --git a/examples/rust/mesh/src/lib.rs b/examples/rust/mesh/src/lib.rs index 775d8e5ec2..ce48153b18 100644 --- a/examples/rust/mesh/src/lib.rs +++ b/examples/rust/mesh/src/lib.rs @@ -48,7 +48,7 @@ pub fn build_cartesian_restriction( degree: usize, num_comp: usize, num_qpts: usize, -) -> libceed::Result<(ElemRestriction, ElemRestriction)> { +) -> libceed::Result<(ElemRestriction<'_>, ElemRestriction<'_>)> { let p = degree + 1; let num_nodes = p.pow(dim as u32); // number of nodes per element let elem_qpts = num_qpts.pow(dim as u32); // number of quadrature pts per element @@ -119,7 +119,7 @@ pub fn cartesian_mesh_coords( num_xyz: [usize; 3], mesh_degree: usize, mesh_size: usize, -) -> libceed::Result { +) -> libceed::Result> { let p = mesh_degree + 1; let mut num_d = [0; 3]; let mut scalar_size = 1; diff --git a/rust/libceed-sys/build.rs b/rust/libceed-sys/build.rs index d1cc93be6e..8c510fcc8c 100644 --- a/rust/libceed-sys/build.rs +++ b/rust/libceed-sys/build.rs @@ -14,6 +14,7 @@ fn main() { } else { // Install libceed.a or libceed.so to $OUT_DIR/lib let makeflags = env("CARGO_MAKEFLAGS").unwrap(); + let optflags = env("CARGO_CEED_OPT_FLAGS").unwrap_or_else(|| "".to_string()); let mut make = Command::new("make"); make.arg("install") .arg(format!("prefix={}", out_dir.to_string_lossy())) @@ -28,6 +29,9 @@ fn main() { .arg("FC=") // Don't try to find Fortran (unused library build/install) .env("MAKEFLAGS", makeflags) .current_dir("c-src"); + if optflags.len() > 0 { + make.env("OPT", optflags); + } if statik { make.arg("STATIC=1"); } diff --git a/rust/libceed/src/operator.rs b/rust/libceed/src/operator.rs index 85cb3a0d18..fae468d3c9 100644 --- a/rust/libceed/src/operator.rs +++ b/rust/libceed/src/operator.rs @@ -175,7 +175,7 @@ impl<'a> OperatorField<'a> { /// # Ok(()) /// # } /// ``` - pub fn elem_restriction(&self) -> ElemRestrictionOpt { + pub fn elem_restriction(&self) -> ElemRestrictionOpt<'_> { if self.elem_restriction.ptr == unsafe { bind_ceed::CEED_ELEMRESTRICTION_NONE } { ElemRestrictionOpt::None } else { @@ -237,7 +237,7 @@ impl<'a> OperatorField<'a> { /// # Ok(()) /// # } /// ``` - pub fn basis(&self) -> BasisOpt { + pub fn basis(&self) -> BasisOpt<'_> { if self.basis.ptr == unsafe { bind_ceed::CEED_BASIS_NONE } { BasisOpt::None } else { @@ -285,7 +285,7 @@ impl<'a> OperatorField<'a> { /// # Ok(()) /// # } /// ``` - pub fn vector(&self) -> VectorOpt { + pub fn vector(&self) -> VectorOpt<'_> { if self.vector.ptr == unsafe { bind_ceed::CEED_VECTOR_ACTIVE } { VectorOpt::Active } else if self.vector.ptr == unsafe { bind_ceed::CEED_VECTOR_NONE } { @@ -856,7 +856,7 @@ impl<'a> Operator<'a> { /// # Ok(()) /// # } /// ``` - pub fn inputs(&self) -> crate::Result> { + pub fn inputs(&self) -> crate::Result>> { // Get array of raw C pointers for inputs let mut num_inputs = 0; let mut inputs_ptr = std::ptr::null_mut(); @@ -926,7 +926,7 @@ impl<'a> Operator<'a> { /// # Ok(()) /// # } /// ``` - pub fn outputs(&self) -> crate::Result> { + pub fn outputs(&self) -> crate::Result>> { // Get array of raw C pointers for outputs let mut num_outputs = 0; let mut outputs_ptr = std::ptr::null_mut(); diff --git a/rust/libceed/src/qfunction.rs b/rust/libceed/src/qfunction.rs index 09912c93be..f1eb5786f9 100644 --- a/rust/libceed/src/qfunction.rs +++ b/rust/libceed/src/qfunction.rs @@ -467,7 +467,7 @@ impl<'a> QFunctionCore<'a> { }) } - pub fn inputs(&self) -> crate::Result<&[QFunctionField]> { + pub fn inputs(&self) -> crate::Result<&[QFunctionField<'_>]> { // Get array of raw C pointers for inputs let mut num_inputs = 0; let mut inputs_ptr = std::ptr::null_mut(); @@ -487,7 +487,7 @@ impl<'a> QFunctionCore<'a> { Ok(inputs_slice) } - pub fn outputs(&self) -> crate::Result<&[QFunctionField]> { + pub fn outputs(&self) -> crate::Result<&[QFunctionField<'_>]> { // Get array of raw C pointers for outputs let mut num_outputs = 0; let mut outputs_ptr = std::ptr::null_mut(); @@ -826,7 +826,7 @@ impl<'a> QFunction<'a> { /// # Ok(()) /// # } /// ``` - pub fn inputs(&self) -> crate::Result<&[QFunctionField]> { + pub fn inputs(&self) -> crate::Result<&[QFunctionField<'_>]> { self.qf_core.inputs() } @@ -856,7 +856,7 @@ impl<'a> QFunction<'a> { /// # Ok(()) /// # } /// ``` - pub fn outputs(&self) -> crate::Result<&[QFunctionField]> { + pub fn outputs(&self) -> crate::Result<&[QFunctionField<'_>]> { self.qf_core.outputs() } } @@ -960,7 +960,7 @@ impl<'a> QFunctionByName<'a> { /// # Ok(()) /// # } /// ``` - pub fn inputs(&self) -> crate::Result<&[QFunctionField]> { + pub fn inputs(&self) -> crate::Result<&[QFunctionField<'_>]> { self.qf_core.inputs() } @@ -979,7 +979,7 @@ impl<'a> QFunctionByName<'a> { /// # Ok(()) /// # } /// ``` - pub fn outputs(&self) -> crate::Result<&[QFunctionField]> { + pub fn outputs(&self) -> crate::Result<&[QFunctionField<'_>]> { self.qf_core.outputs() } } diff --git a/rust/libceed/src/vector.rs b/rust/libceed/src/vector.rs index 42c1c211f0..a1f9cd5178 100644 --- a/rust/libceed/src/vector.rs +++ b/rust/libceed/src/vector.rs @@ -561,7 +561,7 @@ impl<'a> Vector<'a> { /// # Ok(()) /// # } /// ``` - pub fn view(&self) -> crate::Result { + pub fn view(&self) -> crate::Result> { VectorView::new(self) } @@ -583,7 +583,7 @@ impl<'a> Vector<'a> { /// # Ok(()) /// # } /// ``` - pub fn view_mut(&mut self) -> crate::Result { + pub fn view_mut(&mut self) -> crate::Result> { VectorViewMut::new(self) } diff --git a/tests/t599-operator.c b/tests/t599-operator.c index 1690d438cb..a38d6b1f47 100644 --- a/tests/t599-operator.c +++ b/tests/t599-operator.c @@ -124,7 +124,9 @@ int main(int argc, char **argv) { CeedVectorRestoreArrayRead(v, &v_array); // Summing 9 reference elements, each 2x2 => 36 sq units area if (fabs(sum - 4.0 * num_elem) > CEED_EPSILON * 5e3) { + // LCOV_EXCL_START printf("Incorrect area computed, %g != %g (abs error %g)\n", sum, 4.0 * num_elem, fabs(sum - 4.0 * num_elem)); + // LCOV_EXCL_STOP } }