Skip to content

Commit 1a87fc7

Browse files
author
Jorge Aparicio
committed
libcore: use unboxed closures in Formatter methods
1 parent 0b0c3e1 commit 1a87fc7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/libcore/fmt/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use kinds::{Copy, Sized};
1919
use mem;
2020
use option::Option;
2121
use option::Option::{Some, None};
22-
use ops::Deref;
22+
use ops::{Deref, FnOnce};
2323
use result::Result::{Ok, Err};
2424
use result;
2525
use slice::SlicePrelude;
@@ -491,10 +491,9 @@ impl<'a> Formatter<'a> {
491491

492492
/// Runs a callback, emitting the correct padding either before or
493493
/// afterwards depending on whether right or left alignment is requested.
494-
fn with_padding(&mut self,
495-
padding: uint,
496-
default: rt::Alignment,
497-
f: |&mut Formatter| -> Result) -> Result {
494+
fn with_padding<F>(&mut self, padding: uint, default: rt::Alignment, f: F) -> Result where
495+
F: FnOnce(&mut Formatter) -> Result,
496+
{
498497
use char::Char;
499498
let align = match self.align {
500499
rt::AlignUnknown => default,

0 commit comments

Comments
 (0)