Skip to content

Commit

Permalink
Silence clippy lints in ascent!{ … } & ascent_run!{ … } macro exp…
Browse files Browse the repository at this point in the history
…ansions (#12)

* Silence all clippy lints in macro expansion

* Ensure `ascent_run!{ … }` produces a block item, so we can use `#![…]` within it

* Combine some `#![allow(…)]` attributes
  • Loading branch information
regexident authored Jan 21, 2025
1 parent 11a7f17 commit 73ae59c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ascent_macro/src/ascent_codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ pub(crate) fn compile_mir(mir: &AscentMir, is_ascent_run: bool) -> proc_macro2::
quote! {
#[doc = "Runs the Ascent program to a fixed point."]
pub fn run(&mut self) {
#![allow(clippy::all)]
self.run_timeout(::std::time::Duration::MAX);
}
}
Expand All @@ -181,6 +182,7 @@ pub(crate) fn compile_mir(mir: &AscentMir, is_ascent_run: bool) -> proc_macro2::
#[allow(unused_imports, noop_method_call, suspicious_double_ref_op)]
#[doc = "Runs the Ascent program to a fixed point."]
pub fn run(&mut self) {
#![allow(clippy::all)]
macro_rules! __check_return_conditions {() => {};}
#run_usings
self.update_indices_priv();
Expand Down Expand Up @@ -280,6 +282,7 @@ pub(crate) fn compile_mir(mir: &AscentMir, is_ascent_run: bool) -> proc_macro2::
// TODO remove pub update_indices at some point
#[allow(noop_method_call, suspicious_double_ref_op)]
fn update_indices_priv(&mut self) {
#![allow(clippy::all)]
let before = ::ascent::internal::Instant::now();
#update_indices_body
self.update_indices_duration += before.elapsed();
Expand All @@ -290,14 +293,17 @@ pub(crate) fn compile_mir(mir: &AscentMir, is_ascent_run: bool) -> proc_macro2::
self.update_indices_priv();
}
fn type_constraints() {
#![allow(clippy::all)]
#(#type_constraints)*
}
#summary_fn

pub fn relation_sizes_summary(&self) -> String {
#![allow(clippy::all)]
#relation_sizes_body
}
pub fn scc_times_summary(&self) -> String {
#![allow(clippy::all)]
#scc_times_summary_body
}
}
Expand All @@ -320,16 +326,16 @@ pub(crate) fn compile_mir(mir: &AscentMir, is_ascent_run: bool) -> proc_macro2::
res
} else {
quote! {
{
{{
#![allow(unused_imports, noop_method_call, suspicious_double_ref_op, clippy::all)]
#res
let mut __run_res: #struct_name #ty_ty_generics = #struct_name::default();
#[allow(unused_imports, noop_method_call, suspicious_double_ref_op)]
{
ascent::internal::comment("running...");
#run_code
}
__run_res
}
}}
}
}
}
Expand Down

0 comments on commit 73ae59c

Please sign in to comment.