Skip to content

Commit afa7f5b

Browse files
committed
Add #[inline] to Clone impls for primitive types
1 parent f48c043 commit afa7f5b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libcore/clone.rs

+5
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ mod impls {
162162
$(
163163
#[stable(feature = "rust1", since = "1.0.0")]
164164
impl Clone for $t {
165+
#[inline]
165166
fn clone(&self) -> Self {
166167
*self
167168
}
@@ -179,20 +180,23 @@ mod impls {
179180

180181
#[stable(feature = "never_type", since = "1.26.0")]
181182
impl Clone for ! {
183+
#[inline]
182184
fn clone(&self) -> Self {
183185
*self
184186
}
185187
}
186188

187189
#[stable(feature = "rust1", since = "1.0.0")]
188190
impl<T: ?Sized> Clone for *const T {
191+
#[inline]
189192
fn clone(&self) -> Self {
190193
*self
191194
}
192195
}
193196

194197
#[stable(feature = "rust1", since = "1.0.0")]
195198
impl<T: ?Sized> Clone for *mut T {
199+
#[inline]
196200
fn clone(&self) -> Self {
197201
*self
198202
}
@@ -201,6 +205,7 @@ mod impls {
201205
// Shared references can be cloned, but mutable references *cannot*!
202206
#[stable(feature = "rust1", since = "1.0.0")]
203207
impl<'a, T: ?Sized> Clone for &'a T {
208+
#[inline]
204209
fn clone(&self) -> Self {
205210
*self
206211
}

0 commit comments

Comments
 (0)