Skip to content

util: remove unused with function #9354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/libstd/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down