Skip to content

Commit 8018293

Browse files
committed
Switch encode_utf* to by-value self.
1 parent abdeefd commit 8018293

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libcore/char.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ pub trait Char {
183183
/// If the buffer is not large enough, nothing will be written into it
184184
/// and a `None` will be returned.
185185
#[unstable = "pending trait organization"]
186-
fn encode_utf8(&self, dst: &mut [u8]) -> Option<uint>;
186+
fn encode_utf8(self, dst: &mut [u8]) -> Option<uint>;
187187

188188
/// Encodes this character as UTF-16 into the provided `u16` buffer,
189189
/// and then returns the number of `u16`s written.
190190
///
191191
/// If the buffer is not large enough, nothing will be written into it
192192
/// and a `None` will be returned.
193193
#[unstable = "pending trait organization"]
194-
fn encode_utf16(&self, dst: &mut [u16]) -> Option<uint>;
194+
fn encode_utf16(self, dst: &mut [u16]) -> Option<uint>;
195195
}
196196

197197
#[experimental = "trait is experimental"]
@@ -260,9 +260,9 @@ impl Char for char {
260260

261261
#[inline]
262262
#[unstable = "pending error conventions, trait organization"]
263-
fn encode_utf8<'a>(&self, dst: &'a mut [u8]) -> Option<uint> {
263+
fn encode_utf8(self, dst: &mut [u8]) -> Option<uint> {
264264
// Marked #[inline] to allow llvm optimizing it away
265-
let code = *self as u32;
265+
let code = self as u32;
266266
if code < MAX_ONE_B && dst.len() >= 1 {
267267
dst[0] = code as u8;
268268
Some(1)
@@ -288,9 +288,9 @@ impl Char for char {
288288

289289
#[inline]
290290
#[unstable = "pending error conventions, trait organization"]
291-
fn encode_utf16(&self, dst: &mut [u16]) -> Option<uint> {
291+
fn encode_utf16(self, dst: &mut [u16]) -> Option<uint> {
292292
// Marked #[inline] to allow llvm optimizing it away
293-
let mut ch = *self as u32;
293+
let mut ch = self as u32;
294294
if (ch & 0xFFFF_u32) == ch && dst.len() >= 1 {
295295
// The BMP falls through (assuming non-surrogate, as it should)
296296
dst[0] = ch as u16;

0 commit comments

Comments
 (0)