@@ -2283,21 +2283,21 @@ impl<T, A: Allocator> VecDeque<T, A> {
22832283 unsafe { slice:: from_raw_parts_mut ( ptr. add ( self . head ) , self . len ) }
22842284 }
22852285
2286- /// Rotates the double-ended queue `mid ` places to the left.
2286+ /// Rotates the double-ended queue `n ` places to the left.
22872287 ///
22882288 /// Equivalently,
2289- /// - Rotates item `mid ` into the first position.
2290- /// - Pops the first `mid ` items and pushes them to the end.
2291- /// - Rotates `len() - mid ` places to the right.
2289+ /// - Rotates item `n ` into the first position.
2290+ /// - Pops the first `n ` items and pushes them to the end.
2291+ /// - Rotates `len() - n ` places to the right.
22922292 ///
22932293 /// # Panics
22942294 ///
2295- /// If `mid ` is greater than `len()`. Note that `mid == len()`
2295+ /// If `n ` is greater than `len()`. Note that `n == len()`
22962296 /// does _not_ panic and is a no-op rotation.
22972297 ///
22982298 /// # Complexity
22992299 ///
2300- /// Takes `*O*(min(mid , len() - mid ))` time and no extra space.
2300+ /// Takes `*O*(min(n , len() - n ))` time and no extra space.
23012301 ///
23022302 /// # Examples
23032303 ///
@@ -2316,31 +2316,31 @@ impl<T, A: Allocator> VecDeque<T, A> {
23162316 /// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
23172317 /// ```
23182318 #[ stable( feature = "vecdeque_rotate" , since = "1.36.0" ) ]
2319- pub fn rotate_left ( & mut self , mid : usize ) {
2320- assert ! ( mid <= self . len( ) ) ;
2321- let k = self . len - mid ;
2322- if mid <= k {
2323- unsafe { self . rotate_left_inner ( mid ) }
2319+ pub fn rotate_left ( & mut self , n : usize ) {
2320+ assert ! ( n <= self . len( ) ) ;
2321+ let k = self . len - n ;
2322+ if n <= k {
2323+ unsafe { self . rotate_left_inner ( n ) }
23242324 } else {
23252325 unsafe { self . rotate_right_inner ( k) }
23262326 }
23272327 }
23282328
2329- /// Rotates the double-ended queue `k ` places to the right.
2329+ /// Rotates the double-ended queue `n ` places to the right.
23302330 ///
23312331 /// Equivalently,
2332- /// - Rotates the first item into position `k `.
2333- /// - Pops the last `k ` items and pushes them to the front.
2334- /// - Rotates `len() - k ` places to the left.
2332+ /// - Rotates the first item into position `n `.
2333+ /// - Pops the last `n ` items and pushes them to the front.
2334+ /// - Rotates `len() - n ` places to the left.
23352335 ///
23362336 /// # Panics
23372337 ///
2338- /// If `k ` is greater than `len()`. Note that `k == len()`
2338+ /// If `n ` is greater than `len()`. Note that `n == len()`
23392339 /// does _not_ panic and is a no-op rotation.
23402340 ///
23412341 /// # Complexity
23422342 ///
2343- /// Takes `*O*(min(k , len() - k ))` time and no extra space.
2343+ /// Takes `*O*(min(n , len() - n ))` time and no extra space.
23442344 ///
23452345 /// # Examples
23462346 ///
@@ -2359,13 +2359,13 @@ impl<T, A: Allocator> VecDeque<T, A> {
23592359 /// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
23602360 /// ```
23612361 #[ stable( feature = "vecdeque_rotate" , since = "1.36.0" ) ]
2362- pub fn rotate_right ( & mut self , k : usize ) {
2363- assert ! ( k <= self . len( ) ) ;
2364- let mid = self . len - k ;
2365- if k <= mid {
2366- unsafe { self . rotate_right_inner ( k ) }
2362+ pub fn rotate_right ( & mut self , n : usize ) {
2363+ assert ! ( n <= self . len( ) ) ;
2364+ let k = self . len - n ;
2365+ if n <= k {
2366+ unsafe { self . rotate_right_inner ( n ) }
23672367 } else {
2368- unsafe { self . rotate_left_inner ( mid ) }
2368+ unsafe { self . rotate_left_inner ( k ) }
23692369 }
23702370 }
23712371
0 commit comments