Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.

Commit 5c9f92a

Browse files
committed
Move stuff not related to pasting out of method_new
1 parent 73a54c0 commit 5c9f92a

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,15 @@ use paste::paste;
127127

128128
macro_rules! method_new {
129129
($ret:ident) => {
130-
pub struct $ret {}
131-
132-
impl $ret {
133-
paste! {
134-
#[doc = "Create a new `" $ret "` object."]
135-
pub fn new() -> $ret { todo!() }
136-
}
130+
paste! {
131+
#[doc = "Create a new `" $ret "` object."]
132+
pub fn new() -> $ret { todo!() }
137133
}
138134
};
139135
}
140136

137+
pub struct Paste {}
138+
141139
method_new!(Paste); // expands to #[doc = "Create a new `Paste` object"]
142140
```
143141

src/lib.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,15 @@
125125
//!
126126
//! macro_rules! method_new {
127127
//! ($ret:ident) => {
128-
//! pub struct $ret {}
129-
//!
130-
//! impl $ret {
131-
//! paste! {
132-
//! #[doc = "Create a new `" $ret "` object."]
133-
//! pub fn new() -> $ret { todo!() }
134-
//! }
128+
//! paste! {
129+
//! #[doc = "Create a new `" $ret "` object."]
130+
//! pub fn new() -> $ret { todo!() }
135131
//! }
136132
//! };
137133
//! }
138134
//!
135+
//! pub struct Paste {}
136+
//!
139137
//! method_new!(Paste); // expands to #[doc = "Create a new `Paste` object"]
140138
//! ```
141139

0 commit comments

Comments
 (0)