Skip to content

Commit

Permalink
Wrangle warnings (#960)
Browse files Browse the repository at this point in the history
* un-pub some statics that don't have to be pub to fix build under deny(warnings)
* Add allow() for const impl pattern that causes false positives in a rustc lint in derive macros; rust-lang/rust#120363
  • Loading branch information
Shnatsel authored Jan 20, 2025
1 parent 091c84d commit e8e3270
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/tests/app/exit_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use abscissa_core::testing::CmdRunner;
use once_cell::sync::Lazy;

pub static RUNNER: Lazy<CmdRunner> = Lazy::new(|| CmdRunner::default());
static RUNNER: Lazy<CmdRunner> = Lazy::new(|| CmdRunner::default());

#[test]
fn no_args() {
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/generate_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const TEST_COMMANDS: &[&str] = &[
"clippy",
];

pub static RUNNER: Lazy<CmdRunner> = Lazy::new(|| {
static RUNNER: Lazy<CmdRunner> = Lazy::new(|| {
let mut runner = CmdRunner::new("cargo");
runner.exclusive();
runner
Expand Down
6 changes: 6 additions & 0 deletions derive/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ pub fn derive_command(s: Structure<'_>) -> TokenStream {
let subcommand_usage = quote!();

s.gen_impl(quote! {
#[allow(unknown_lints)]
#[allow(non_local_definitions)]
gen impl Command for @Self {
#[doc = "Name of this program as a string"]
fn name() -> &'static str {
Expand Down Expand Up @@ -44,6 +46,8 @@ mod tests {
expands to {
#[allow(non_upper_case_globals)]
const _DERIVE_Command_FOR_MyCommand: () = {
#[allow(unknown_lints)]
#[allow(non_local_definitions)]
impl Command for MyCommand {
#[doc = "Name of this program as a string"]
fn name() -> & 'static str {
Expand Down Expand Up @@ -79,6 +83,8 @@ mod tests {
expands to {
#[allow(non_upper_case_globals)]
const _DERIVE_Command_FOR_MyCommand: () = {
#[allow(unknown_lints)]
#[allow(non_local_definitions)]
impl Command for MyCommand {
#[doc = "Name of this program as a string"]
fn name() -> & 'static str {
Expand Down
4 changes: 4 additions & 0 deletions derive/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub fn derive_component(s: Structure<'_>) -> TokenStream {
let dependency_methods = attrs.dependency_methods();

s.gen_impl(quote! {
#[allow(unknown_lints)]
#[allow(non_local_definitions)]
gen impl<A> Component<A> for @Self
where
A: #abscissa_core::Application
Expand Down Expand Up @@ -199,6 +201,8 @@ mod tests {
expands to {
#[allow(non_upper_case_globals)]
const _DERIVE_Component_A_FOR_MyComponent: () = {
#[allow(unknown_lints)]
#[allow(non_local_definitions)]
impl<A> Component<A> for MyComponent
where
A: abscissa_core::Application
Expand Down
4 changes: 4 additions & 0 deletions derive/src/runnable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ pub fn derive_runnable(s: synstructure::Structure<'_>) -> proc_macro2::TokenStre
});

s.gen_impl(quote! {
#[allow(unknown_lints)]
#[allow(non_local_definitions)]
gen impl Runnable for @Self {
fn run(&self) {
match *self { #body }
Expand All @@ -33,6 +35,8 @@ mod tests {
expands to {
#[allow(non_upper_case_globals)]
const _DERIVE_Runnable_FOR_MyRunnable: () = {
#[allow(unknown_lints)]
#[allow(non_local_definitions)]
impl Runnable for MyRunnable {
fn run(&self) {
match *self {
Expand Down

0 comments on commit e8e3270

Please sign in to comment.