Skip to content

Commit

Permalink
fix(macros/message): irregular non_snake_case by RA
Browse files Browse the repository at this point in the history
  • Loading branch information
loyd committed Dec 1, 2024
1 parent 83dba92 commit fa02ecf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- core: update the `idr-ebr` crate to v0.3 to fix possible crash in `Context::finished()`.
- logger: replace the `atty` crate with `IsTerminal` to fix cargo-audit warnings.
- macros/msg: better go-to-definition via RA ([#141]).
- macros/message: irregular warnings about `non_snake_case` by RA.

[#74]: https://github.com/elfo-rs/elfo/issues/74
[#135]: https://github.com/elfo-rs/elfo/pull/135
Expand Down
17 changes: 8 additions & 9 deletions elfo-macros-impl/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub fn message_impl(

let serde_transparent_attr = args.transparent.then(|| quote! { #[serde(transparent)] });

// TODO: pass to `_elfo_Wrapper`.
// TODO: pass to `ElfoResponseWrapper`.
let dumping_allowed = args.dumping_allowed.unwrap_or(true);

let protocol = if let Some(protocol) = &args.protocol {
Expand Down Expand Up @@ -234,29 +234,29 @@ pub fn message_impl(
quote! {
impl #crate_::Request for #name {
type Response = #ret;
type Wrapper = _elfo_Wrapper;
type Wrapper = ElfoResponseWrapper;
}

#[message(not(Debug), #protocol name = #wrapper_name_str, elfo = #crate_)]
pub struct _elfo_Wrapper(#ret);
pub struct ElfoResponseWrapper(#ret);

impl ::std::fmt::Debug for _elfo_Wrapper {
impl ::std::fmt::Debug for ElfoResponseWrapper {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
self.0.fmt(f)
}
}

impl From<#ret> for _elfo_Wrapper {
impl From<#ret> for ElfoResponseWrapper {
#[inline]
fn from(inner: #ret) -> Self {
_elfo_Wrapper(inner)
ElfoResponseWrapper(inner)
}
}

impl From<_elfo_Wrapper> for #ret {
impl From<ElfoResponseWrapper> for #ret {
#[inline]
fn from(wrapper: _elfo_Wrapper) -> Self {
fn from(wrapper: ElfoResponseWrapper) -> Self {
wrapper.0
}
}
Expand All @@ -277,7 +277,6 @@ pub fn message_impl(
#input

#[doc(hidden)]
#[allow(non_snake_case)]
#[allow(unreachable_code)] // for `enum Impossible {}`
const _: () = {
#impl_message
Expand Down

0 comments on commit fa02ecf

Please sign in to comment.