Skip to content
Permalink
Browse files

Fix the fallout

  • Loading branch information...
petrochenkov committed Sep 14, 2016
1 parent fdda698 commit 42752eaec2f8795fba695e823881e3fbd2e50c74
@@ -493,7 +493,7 @@ impl<T: Ord> BinaryHeap<T> {
/// assert_eq!(heap.pop(), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn pop(&mut self) -> Option<T> {
pub fn pop(mut self: &mut Self) -> Option<T> {
self.data.pop().map(|mut item| {
if !self.is_empty() {
swap(&mut item, &mut self.data[0]);
@@ -111,7 +111,7 @@ impl<T> LinkedList<T> {

/// Removes and returns the node at the front of the list.
#[inline]
fn pop_front_node(&mut self) -> Option<Box<Node<T>>> {
fn pop_front_node(mut self: &mut Self) -> Option<Box<Node<T>>> {
self.head.map(|node| unsafe {
let node = Box::from_raw(*node);
self.head = node.next;
@@ -146,7 +146,7 @@ impl<T> LinkedList<T> {

/// Removes and returns the node at the back of the list.
#[inline]
fn pop_back_node(&mut self) -> Option<Box<Node<T>>> {
fn pop_back_node(mut self: &mut Self) -> Option<Box<Node<T>>> {
self.tail.map(|node| unsafe {
let node = Box::from_raw(*node);
self.tail = node.prev;
@@ -716,7 +716,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;

#[inline]
fn next(&mut self) -> Option<&'a T> {
fn next(mut self: &mut Self) -> Option<&'a T> {
if self.len == 0 {
None
} else {
@@ -738,7 +738,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<&'a T> {
fn next_back(mut self: &mut Self) -> Option<&'a T> {
if self.len == 0 {
None
} else {
@@ -763,7 +763,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
type Item = &'a mut T;

#[inline]
fn next(&mut self) -> Option<&'a mut T> {
fn next(mut self: &mut Self) -> Option<&'a mut T> {
if self.len == 0 {
None
} else {
@@ -785,7 +785,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<&'a mut T> {
fn next_back(mut self: &mut Self) -> Option<&'a mut T> {
if self.len == 0 {
None
} else {
@@ -740,7 +740,7 @@ impl<I: Iterator<Item = u8>> Iterator for DecodeUtf8<I> {
type Item = Result<char, InvalidSequence>;
#[inline]

fn next(&mut self) -> Option<Result<char, InvalidSequence>> {
fn next(mut self: &mut Self) -> Option<Result<char, InvalidSequence>> {
self.0.next().map(|first_byte| {
// Emit InvalidSequence according to
// Unicode §5.22 Best Practice for U+FFFD Substitution
@@ -75,7 +75,7 @@ pub fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>,
impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
/// Adds a new field to the generated struct output.
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn field(&mut self, name: &str, value: &fmt::Debug) -> &mut DebugStruct<'a, 'b> {
pub fn field(mut self: &mut Self, name: &str, value: &fmt::Debug) -> &mut DebugStruct<'a, 'b> {
self.result = self.result.and_then(|_| {
let prefix = if self.has_fields {
","
@@ -98,7 +98,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {

/// Finishes output and returns any error encountered.
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn finish(&mut self) -> fmt::Result {
pub fn finish(mut self: &mut Self) -> fmt::Result {
if self.has_fields {
self.result = self.result.and_then(|_| {
if self.is_pretty() {
@@ -142,7 +142,7 @@ pub fn debug_tuple_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> D
impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
/// Adds a new field to the generated tuple struct output.
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn field(&mut self, value: &fmt::Debug) -> &mut DebugTuple<'a, 'b> {
pub fn field(mut self: &mut Self, value: &fmt::Debug) -> &mut DebugTuple<'a, 'b> {
self.result = self.result.and_then(|_| {
let (prefix, space) = if self.fields > 0 {
(",", " ")
@@ -164,7 +164,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {

/// Finishes output and returns any error encountered.
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn finish(&mut self) -> fmt::Result {
pub fn finish(mut self: &mut Self) -> fmt::Result {
if self.fields > 0 {
self.result = self.result.and_then(|_| {
if self.is_pretty() {
@@ -191,7 +191,7 @@ struct DebugInner<'a, 'b: 'a> {
}

impl<'a, 'b: 'a> DebugInner<'a, 'b> {
fn entry(&mut self, entry: &fmt::Debug) {
fn entry(mut self: &mut Self, entry: &fmt::Debug) {
self.result = self.result.and_then(|_| {
if self.is_pretty() {
let mut writer = PadAdapter::new(self.fmt);
@@ -214,7 +214,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
self.has_fields = true;
}

pub fn finish(&mut self) {
pub fn finish(mut self: &mut Self) {
let prefix = if self.is_pretty() && self.has_fields {
"\n"
} else {
@@ -271,7 +271,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {

/// Finishes output and returns any error encountered.
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn finish(&mut self) -> fmt::Result {
pub fn finish(mut self: &mut Self) -> fmt::Result {
self.inner.finish();
self.inner.result.and_then(|_| self.inner.fmt.write_str("}"))
}
@@ -320,7 +320,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {

/// Finishes output and returns any error encountered.
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn finish(&mut self) -> fmt::Result {
pub fn finish(mut self: &mut Self) -> fmt::Result {
self.inner.finish();
self.inner.result.and_then(|_| self.inner.fmt.write_str("]"))
}
@@ -350,7 +350,7 @@ pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b
impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// Adds a new entry to the map output.
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn entry(&mut self, key: &fmt::Debug, value: &fmt::Debug) -> &mut DebugMap<'a, 'b> {
pub fn entry(mut self: &mut Self, key: &fmt::Debug, value: &fmt::Debug) -> &mut DebugMap<'a, 'b> {
self.result = self.result.and_then(|_| {
if self.is_pretty() {
let mut writer = PadAdapter::new(self.fmt);
@@ -390,7 +390,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {

/// Finishes output and returns any error encountered.
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn finish(&mut self) -> fmt::Result {
pub fn finish(mut self: &mut Self) -> fmt::Result {
let prefix = if self.is_pretty() && self.has_fields {
"\n"
} else {
@@ -703,7 +703,7 @@ impl<A, B> ZipImpl<A, B> for Zip<A, B>
}

#[inline]
default fn next(&mut self) -> Option<(A::Item, B::Item)> {
default fn next(mut self: &mut Self) -> Option<(A::Item, B::Item)> {
self.a.next().and_then(|x| {
self.b.next().and_then(|y| {
Some((x, y))
@@ -1080,7 +1080,7 @@ impl<I> Iterator for Enumerate<I> where I: Iterator {
/// Might panic if the index of the element overflows a `usize`.
#[inline]
#[rustc_inherit_overflow_checks]
fn next(&mut self) -> Option<(usize, <I as Iterator>::Item)> {
fn next(mut self: &mut Self) -> Option<(usize, <I as Iterator>::Item)> {
self.iter.next().map(|a| {
let ret = (self.count, a);
// Possible undefined overflow.
@@ -1096,7 +1096,7 @@ impl<I> Iterator for Enumerate<I> where I: Iterator {

#[inline]
#[rustc_inherit_overflow_checks]
fn nth(&mut self, n: usize) -> Option<(usize, I::Item)> {
fn nth(mut self: &mut Self, n: usize) -> Option<(usize, I::Item)> {
self.iter.nth(n).map(|a| {
let i = self.count + n;
self.count = i + 1;
@@ -1348,7 +1348,7 @@ impl<I: Iterator, P> Iterator for TakeWhile<I, P>
type Item = I::Item;

#[inline]
fn next(&mut self) -> Option<I::Item> {
fn next(mut self: &mut Self) -> Option<I::Item> {
if self.flag {
None
} else {
@@ -1566,7 +1566,7 @@ impl<B, I, St, F> Iterator for Scan<I, St, F> where
type Item = B;

#[inline]
fn next(&mut self) -> Option<B> {
fn next(mut self: &mut Self) -> Option<B> {
self.iter.next().and_then(|a| (self.f)(&mut self.state, a))
}

@@ -1154,7 +1154,7 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
type Item = &'a [T];

#[inline]
fn next(&mut self) -> Option<&'a [T]> {
fn next(mut self: &mut Self) -> Option<&'a [T]> {
if self.finished { return None; }

match self.v.iter().position(|x| (self.pred)(x)) {
@@ -1180,7 +1180,7 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
#[inline]
fn next_back(&mut self) -> Option<&'a [T]> {
fn next_back(mut self: &mut Self) -> Option<&'a [T]> {
if self.finished { return None; }

match self.v.iter().rposition(|x| (self.pred)(x)) {
@@ -1240,11 +1240,11 @@ impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
type Item = &'a mut [T];

#[inline]
fn next(&mut self) -> Option<&'a mut [T]> {
fn next(mut self: &mut Self) -> Option<&'a mut [T]> {
if self.finished { return None; }

let idx_opt = { // work around borrowck limitations
let pred = &mut self.pred;
let mut pred = &mut self.pred;
self.v.iter().position(|x| (*pred)(x))
};
match idx_opt {
@@ -1275,11 +1275,11 @@ impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where
P: FnMut(&T) -> bool,
{
#[inline]
fn next_back(&mut self) -> Option<&'a mut [T]> {
fn next_back(mut self: &mut Self) -> Option<&'a mut [T]> {
if self.finished { return None; }

let idx_opt = { // work around borrowck limitations
let pred = &mut self.pred;
let mut pred = &mut self.pred;
self.v.iter().rposition(|x| (*pred)(x))
};
match idx_opt {
@@ -150,7 +150,7 @@ impl<I> Iterator for Utf16Encoder<I>
type Item = u16;

#[inline]
fn next(&mut self) -> Option<u16> {
fn next(mut self: &mut Self) -> Option<u16> {
if self.extra != 0 {
let tmp = self.extra;
self.extra = 0;
@@ -906,7 +906,7 @@ unsafe impl<'a, K: Send, V: Send> Send for Drain<'a, K, V> {}
impl<'a, K, V> Iterator for Iter<'a, K, V> {
type Item = (&'a K, &'a V);

fn next(&mut self) -> Option<(&'a K, &'a V)> {
fn next(mut self: &mut Self) -> Option<(&'a K, &'a V)> {
self.iter.next().map(|bucket| {
self.elems_left -= 1;
unsafe { (&*bucket.key, &*bucket.val) }
@@ -926,7 +926,7 @@ impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {
impl<'a, K, V> Iterator for IterMut<'a, K, V> {
type Item = (&'a K, &'a mut V);

fn next(&mut self) -> Option<(&'a K, &'a mut V)> {
fn next(mut self: &mut Self) -> Option<(&'a K, &'a mut V)> {
self.iter.next().map(|bucket| {
self.elems_left -= 1;
unsafe { (&*bucket.key, &mut *(bucket.val as *mut V)) }
@@ -946,7 +946,7 @@ impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {
impl<K, V> Iterator for IntoIter<K, V> {
type Item = (SafeHash, K, V);

fn next(&mut self) -> Option<(SafeHash, K, V)> {
fn next(mut self: &mut Self) -> Option<(SafeHash, K, V)> {
self.iter.next().map(|bucket| {
self.table.size -= 1;
unsafe {
@@ -471,7 +471,7 @@ impl<W: Write> Write for BufWriter<W> {
Write::write(&mut self.buf, buf)
}
}
fn flush(&mut self) -> io::Result<()> {
fn flush(mut self: &mut Self) -> io::Result<()> {
self.flush_buf().and_then(|()| self.get_mut().flush())
}
}
@@ -491,7 +491,7 @@ impl<W: Write + Seek> Seek for BufWriter<W> {
/// Seek to the offset, in bytes, in the underlying writer.
///
/// Seeking always writes out the internal buffer before seeking.
fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> {
fn seek(mut self: &mut Self, pos: SeekFrom) -> io::Result<u64> {
self.flush_buf().and_then(|_| self.get_mut().seek(pos))
}
}
@@ -548,7 +548,7 @@ pub trait Read {
/// # }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
fn read_to_string(mut self: &mut Self, buf: &mut String) -> Result<usize> {
// Note that we do *not* call `.read_to_end()` here. We are passing
// `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
// method to fill it up. An arbitrary implementation could overwrite the
@@ -1347,7 +1347,7 @@ pub trait BufRead: Read {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn read_line(&mut self, buf: &mut String) -> Result<usize> {
fn read_line(mut self: &mut Self, buf: &mut String) -> Result<usize> {
// Note that we are not calling the `.read_until` method here, but
// rather our hardcoded implementation. For more details as to why, see
// the comments in `read_to_end`.
@@ -63,7 +63,7 @@ impl<'a> Parser<'a> {
// Return result of first successful parser
fn read_or<T>(&mut self, parsers: &mut [Box<FnMut(&mut Parser) -> Option<T> + 'static>])
-> Option<T> {
for pf in parsers {
for mut pf in parsers {
if let Some(r) = self.read_atomically(|p: &mut Parser| pf(p)) {
return Some(r);
}
@@ -95,7 +95,7 @@ impl<T> Packet<T> {
// threads in select().
//
// This can only be called at channel-creation time
pub fn inherit_blocker(&mut self,
pub fn inherit_blocker(mut self: &mut Self,
token: Option<SignalToken>,
guard: MutexGuard<()>) {
token.map(|token| {
@@ -733,7 +733,7 @@ impl<'a> Iterator for EncodeWide<'a> {
type Item = u16;

#[inline]
fn next(&mut self) -> Option<u16> {
fn next(mut self: &mut Self) -> Option<u16> {
if self.extra != 0 {
let tmp = self.extra;
self.extra = 0;
@@ -185,7 +185,7 @@ fn read_byte(r: &mut io::Read) -> io::Result<u8> {

/// Parse a compiled terminfo entry, using long capability names if `longnames`
/// is true
pub fn parse(file: &mut io::Read, longnames: bool) -> Result<TermInfo, String> {
pub fn parse(mut file: &mut io::Read, longnames: bool) -> Result<TermInfo, String> {
macro_rules! t( ($e:expr) => (
match $e {
Ok(e) => e,

0 comments on commit 42752ea

Please sign in to comment.
You can’t perform that action at this time.