diff options
| author | bors <bors@rust-lang.org> | 2013-09-21 01:35:59 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-21 01:35:59 -0700 |
| commit | 55f528f5af84769b178dd0ff075d1c1fa2329f5a (patch) | |
| tree | 2fc74a7eacaf2c30e1fd27f13e7a3306a18809d4 /src/libstd | |
| parent | db78fdc10c0cf6c02005c0b8daefe9cf47aa806f (diff) | |
| parent | 807725b995a14c0aac5926c77636d3998b82dc9d (diff) | |
| download | rust-55f528f5af84769b178dd0ff075d1c1fa2329f5a.tar.gz rust-55f528f5af84769b178dd0ff075d1c1fa2329f5a.zip | |
auto merge of #9354 : thestinger/rust/cleanup, r=alexcrichton
I don't see the point of this function, and there are no users.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/util.rs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/libstd/util.rs b/src/libstd/util.rs index 4acc1f3abff..64bdc7fe8cd 100644 --- a/src/libstd/util.rs +++ b/src/libstd/util.rs @@ -23,25 +23,6 @@ pub fn id<T>(x: T) -> T { x } #[inline] pub fn ignore<T>(_x: T) { } -/// Sets `*ptr` to `new_value`, invokes `op()`, and then restores the -/// original value of `*ptr`. -/// -/// NB: This function accepts `@mut T` and not `&mut T` to avoid -/// an obvious borrowck hazard. Typically passing in `&mut T` will -/// cause borrow check errors because it freezes whatever location -/// that `&mut T` is stored in (either statically or dynamically). -#[inline] -pub fn with<T,R>( - ptr: @mut T, - value: T, - op: &fn() -> R) -> R -{ - let prev = replace(ptr, value); - let result = op(); - *ptr = prev; - return result; -} - /** * Swap the values at two mutable locations of the same type, without * deinitialising or copying either one. |
