Skip to content

Commit c1911ba

Browse files
committedFeb 25, 2019
Auto merge of #58714 - Centril:rollup, r=Centril
Rollup of 5 pull requests Successful merges: - #58370 (Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S>) - #58421 (Relax some Ord bounds on BinaryHeap<T>) - #58686 (replace deprecated rustfmt_skip with rustfmt::skip) - #58697 (Use ? in some macros) - #58704 (Remove some unnecessary 'extern crate') Failed merges: r? @ghost
·
1.87.01.34.0
2 parents eb1df8c + 6806d0c commit c1911ba

File tree

24 files changed

+634
-669
lines changed

24 files changed

+634
-669
lines changed
 

‎src/bootstrap/bin/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
88
#![deny(warnings)]
99

10-
extern crate bootstrap;
11-
1210
use std::env;
1311

1412
use bootstrap::{Config, Build};

‎src/bootstrap/bin/rustc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
1818
#![deny(warnings)]
1919

20-
extern crate bootstrap;
21-
2220
use std::env;
2321
use std::ffi::OsString;
2422
use std::io;

‎src/bootstrap/bin/rustdoc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
55
#![deny(warnings)]
66

7-
extern crate bootstrap;
8-
97
use std::env;
108
use std::process::Command;
119
use std::path::PathBuf;

‎src/bootstrap/bin/sccache-plus-cl.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate cc;
2-
31
use std::env;
42
use std::process::{self, Command};
53

‎src/bootstrap/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ pub enum Kind {
326326
impl<'a> Builder<'a> {
327327
fn get_step_descriptions(kind: Kind) -> Vec<StepDescription> {
328328
macro_rules! describe {
329-
($($rule:ty),+ $(,)*) => {{
329+
($($rule:ty),+ $(,)?) => {{
330330
vec![$(StepDescription::from::<$rule>()),+]
331331
}};
332332
}

‎src/bootstrap/lib.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,11 @@ extern crate build_helper;
114114
extern crate serde_derive;
115115
#[macro_use]
116116
extern crate lazy_static;
117-
extern crate serde_json;
118-
extern crate cmake;
119-
extern crate filetime;
120-
extern crate cc;
121-
extern crate getopts;
122-
extern crate num_cpus;
123-
extern crate toml;
124-
extern crate time;
125-
extern crate petgraph;
126117

127118
#[cfg(test)]
128119
#[macro_use]
129120
extern crate pretty_assertions;
130121

131-
#[cfg(unix)]
132-
extern crate libc;
133-
134122
use std::cell::{RefCell, Cell};
135123
use std::collections::{HashSet, HashMap};
136124
use std::env;

‎src/liballoc/benches/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#![feature(repr_simd)]
22
#![feature(test)]
33

4-
extern crate rand;
5-
extern crate rand_xorshift;
64
extern crate test;
75

86
mod btree;

‎src/liballoc/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl<T: Clone> Clone for Box<T> {
326326
/// let x = Box::new(5);
327327
/// let y = x.clone();
328328
/// ```
329-
#[rustfmt_skip]
329+
#[rustfmt::skip]
330330
#[inline]
331331
fn clone(&self) -> Box<T> {
332332
box { (**self).clone() }

‎src/liballoc/collections/binary_heap.rs

Lines changed: 244 additions & 244 deletions
Large diffs are not rendered by default.

‎src/liballoc/tests/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#![feature(unboxed_closures)]
99
#![feature(vecdeque_rotate)]
1010

11-
extern crate core;
12-
extern crate rand;
13-
1411
use std::hash::{Hash, Hasher};
1512
use std::collections::hash_map::DefaultHasher;
1613

‎src/libproc_macro/bridge/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ impl fmt::Debug for Span {
222222

223223
macro_rules! define_client_side {
224224
($($name:ident {
225-
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
226-
}),* $(,)*) => {
225+
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)*;)*
226+
}),* $(,)?) => {
227227
$(impl $name {
228228
$(pub(crate) fn $method($($arg: $arg_ty),*) $(-> $ret_ty)* {
229229
Bridge::with(|bridge| {

‎src/libproc_macro/bridge/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ mod api_tags {
225225

226226
macro_rules! declare_tags {
227227
($($name:ident {
228-
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
229-
}),* $(,)*) => {
228+
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)*;)*
229+
}),* $(,)?) => {
230230
$(
231231
pub(super) enum $name {
232232
$($method),*
@@ -307,7 +307,7 @@ impl<T: Unmark> Unmark for Option<T> {
307307
}
308308

309309
macro_rules! mark_noop {
310-
($($ty:ty),* $(,)*) => {
310+
($($ty:ty),* $(,)?) => {
311311
$(
312312
impl Mark for $ty {
313313
type Unmarked = Self;

‎src/libproc_macro/bridge/rpc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ macro_rules! rpc_encode_decode {
5353
}
5454
}
5555
};
56-
(struct $name:ident { $($field:ident),* $(,)* }) => {
56+
(struct $name:ident { $($field:ident),* $(,)? }) => {
5757
impl<S> Encode<S> for $name {
5858
fn encode(self, w: &mut Writer, s: &mut S) {
5959
$(self.$field.encode(w, s);)*
@@ -68,8 +68,8 @@ macro_rules! rpc_encode_decode {
6868
}
6969
}
7070
};
71-
(enum $name:ident $(<$($T:ident),+>)* { $($variant:ident $(($field:ident))*),* $(,)* }) => {
72-
impl<S, $($($T: Encode<S>),+)*> Encode<S> for $name $(<$($T),+>)* {
71+
(enum $name:ident $(<$($T:ident),+>)? { $($variant:ident $(($field:ident))*),* $(,)? }) => {
72+
impl<S, $($($T: Encode<S>),+)?> Encode<S> for $name $(<$($T),+>)* {
7373
fn encode(self, w: &mut Writer, s: &mut S) {
7474
// HACK(eddyb): `Tag` enum duplicated between the
7575
// two impls as there's no other place to stash it.

‎src/libproc_macro/bridge/server.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ macro_rules! associated_item {
3939

4040
macro_rules! declare_server_traits {
4141
($($name:ident {
42-
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
43-
}),* $(,)*) => {
42+
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)?;)*
43+
}),* $(,)?) => {
4444
pub trait Types {
4545
$(associated_item!(type $name);)*
4646
}
4747

4848
$(pub trait $name: Types {
49-
$(associated_item!(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)*);)*
49+
$(associated_item!(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)?);)*
5050
})*
5151

5252
pub trait Server: Types $(+ $name)* {}
@@ -59,14 +59,14 @@ pub(super) struct MarkedTypes<S: Types>(S);
5959

6060
macro_rules! define_mark_types_impls {
6161
($($name:ident {
62-
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
63-
}),* $(,)*) => {
62+
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)?;)*
63+
}),* $(,)?) => {
6464
impl<S: Types> Types for MarkedTypes<S> {
6565
$(type $name = Marked<S::$name, client::$name>;)*
6666
}
6767

6868
$(impl<S: $name> $name for MarkedTypes<S> {
69-
$(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)* {
69+
$(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)? {
7070
<_>::mark($name::$method(&mut self.0, $($arg.unmark()),*))
7171
})*
7272
})*
@@ -81,8 +81,8 @@ struct Dispatcher<S: Types> {
8181

8282
macro_rules! define_dispatcher_impl {
8383
($($name:ident {
84-
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
85-
}),* $(,)*) => {
84+
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)?;)*
85+
}),* $(,)?) => {
8686
// FIXME(eddyb) `pub` only for `ExecutionStrategy` below.
8787
pub trait DispatcherTrait {
8888
// HACK(eddyb) these are here to allow `Self::$name` to work below.

‎src/librustc/dep_graph/dep_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ macro_rules! define_dep_nodes {
111111
(<$tcx:tt>
112112
$(
113113
[$($attr:ident),* ]
114-
$variant:ident $(( $tuple_arg_ty:ty $(,)* ))*
114+
$variant:ident $(( $tuple_arg_ty:ty $(,)? ))*
115115
$({ $($struct_arg_name:ident : $struct_arg_ty:ty),* })*
116116
,)*
117117
) => (

‎src/librustc/macros.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ macro_rules! CloneTypeFoldableAndLiftImpls {
257257
macro_rules! BraceStructLiftImpl {
258258
(impl<$($p:tt),*> Lift<$tcx:tt> for $s:path {
259259
type Lifted = $lifted:ty;
260-
$($field:ident),* $(,)*
260+
$($field:ident),* $(,)?
261261
} $(where $($wc:tt)*)*) => {
262262
impl<$($p),*> $crate::ty::Lift<$tcx> for $s
263263
$(where $($wc)*)*
@@ -327,7 +327,7 @@ macro_rules! EnumLiftImpl {
327327
#[macro_export]
328328
macro_rules! BraceStructTypeFoldableImpl {
329329
(impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path {
330-
$($field:ident),* $(,)*
330+
$($field:ident),* $(,)?
331331
} $(where $($wc:tt)*)*) => {
332332
impl<$($p),*> $crate::ty::fold::TypeFoldable<$tcx> for $s
333333
$(where $($wc)*)*
@@ -354,7 +354,7 @@ macro_rules! BraceStructTypeFoldableImpl {
354354
#[macro_export]
355355
macro_rules! TupleStructTypeFoldableImpl {
356356
(impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path {
357-
$($field:ident),* $(,)*
357+
$($field:ident),* $(,)?
358358
} $(where $($wc:tt)*)*) => {
359359
impl<$($p),*> $crate::ty::fold::TypeFoldable<$tcx> for $s
360360
$(where $($wc)*)*
@@ -426,7 +426,7 @@ macro_rules! EnumTypeFoldableImpl {
426426
};
427427

428428
(@FoldVariants($this:expr, $folder:expr)
429-
input( ($variant:path) { $($variant_arg:ident),* $(,)* } , $($input:tt)*)
429+
input( ($variant:path) { $($variant_arg:ident),* $(,)? } , $($input:tt)*)
430430
output( $($output:tt)*) ) => {
431431
EnumTypeFoldableImpl!(
432432
@FoldVariants($this, $folder)
@@ -480,7 +480,7 @@ macro_rules! EnumTypeFoldableImpl {
480480
};
481481

482482
(@VisitVariants($this:expr, $visitor:expr)
483-
input( ($variant:path) { $($variant_arg:ident),* $(,)* } , $($input:tt)*)
483+
input( ($variant:path) { $($variant_arg:ident),* $(,)? } , $($input:tt)*)
484484
output( $($output:tt)*) ) => {
485485
EnumTypeFoldableImpl!(
486486
@VisitVariants($this, $visitor)

‎src/librustc_errors/diagnostic_builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ macro_rules! forward {
3636
// Forward pattern for &self -> &Self
3737
(
3838
$(#[$attrs:meta])*
39-
pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)*) -> &Self
39+
pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)?) -> &Self
4040
) => {
4141
$(#[$attrs])*
4242
pub fn $n(&self, $($name: $ty),*) -> &Self {
@@ -48,7 +48,7 @@ macro_rules! forward {
4848
// Forward pattern for &mut self -> &mut Self
4949
(
5050
$(#[$attrs:meta])*
51-
pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)*) -> &mut Self
51+
pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)?) -> &mut Self
5252
) => {
5353
$(#[$attrs])*
5454
pub fn $n(&mut self, $($name: $ty),*) -> &mut Self {
@@ -64,7 +64,7 @@ macro_rules! forward {
6464
pub fn $n:ident<S: Into<MultiSpan>>(
6565
&mut self,
6666
$($name:ident: $ty:ty),*
67-
$(,)*
67+
$(,)?
6868
) -> &mut Self
6969
) => {
7070
$(#[$attrs])*

‎src/librustdoc/clean/cfg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ mod test {
431431
}
432432

433433
macro_rules! dummy_meta_item_list {
434-
($name:ident, [$($list:ident),* $(,)*]) => {
434+
($name:ident, [$($list:ident),* $(,)?]) => {
435435
MetaItem {
436436
ident: Path::from_ident(Ident::from_str(stringify!($name))),
437437
node: MetaItemKind::List(vec![
@@ -445,7 +445,7 @@ mod test {
445445
}
446446
};
447447

448-
($name:ident, [$($list:expr),* $(,)*]) => {
448+
($name:ident, [$($list:expr),* $(,)?]) => {
449449
MetaItem {
450450
ident: Path::from_ident(Ident::from_str(stringify!($name))),
451451
node: MetaItemKind::List(vec![

‎src/libstd/collections/hash/map.rs

Lines changed: 229 additions & 236 deletions
Large diffs are not rendered by default.

‎src/libstd/collections/hash/set.rs

Lines changed: 114 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,118 @@ impl<T: Hash + Eq> HashSet<T, RandomState> {
149149
}
150150
}
151151

152+
impl<T, S> HashSet<T, S> {
153+
/// Returns the number of elements the set can hold without reallocating.
154+
///
155+
/// # Examples
156+
///
157+
/// ```
158+
/// use std::collections::HashSet;
159+
/// let set: HashSet<i32> = HashSet::with_capacity(100);
160+
/// assert!(set.capacity() >= 100);
161+
/// ```
162+
#[inline]
163+
#[stable(feature = "rust1", since = "1.0.0")]
164+
pub fn capacity(&self) -> usize {
165+
self.map.capacity()
166+
}
167+
168+
/// An iterator visiting all elements in arbitrary order.
169+
/// The iterator element type is `&'a T`.
170+
///
171+
/// # Examples
172+
///
173+
/// ```
174+
/// use std::collections::HashSet;
175+
/// let mut set = HashSet::new();
176+
/// set.insert("a");
177+
/// set.insert("b");
178+
///
179+
/// // Will print in an arbitrary order.
180+
/// for x in set.iter() {
181+
/// println!("{}", x);
182+
/// }
183+
/// ```
184+
#[stable(feature = "rust1", since = "1.0.0")]
185+
pub fn iter(&self) -> Iter<T> {
186+
Iter { iter: self.map.keys() }
187+
}
188+
189+
/// Returns the number of elements in the set.
190+
///
191+
/// # Examples
192+
///
193+
/// ```
194+
/// use std::collections::HashSet;
195+
///
196+
/// let mut v = HashSet::new();
197+
/// assert_eq!(v.len(), 0);
198+
/// v.insert(1);
199+
/// assert_eq!(v.len(), 1);
200+
/// ```
201+
#[stable(feature = "rust1", since = "1.0.0")]
202+
pub fn len(&self) -> usize {
203+
self.map.len()
204+
}
205+
206+
/// Returns `true` if the set contains no elements.
207+
///
208+
/// # Examples
209+
///
210+
/// ```
211+
/// use std::collections::HashSet;
212+
///
213+
/// let mut v = HashSet::new();
214+
/// assert!(v.is_empty());
215+
/// v.insert(1);
216+
/// assert!(!v.is_empty());
217+
/// ```
218+
#[stable(feature = "rust1", since = "1.0.0")]
219+
pub fn is_empty(&self) -> bool {
220+
self.map.is_empty()
221+
}
222+
223+
/// Clears the set, returning all elements in an iterator.
224+
///
225+
/// # Examples
226+
///
227+
/// ```
228+
/// use std::collections::HashSet;
229+
///
230+
/// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
231+
/// assert!(!set.is_empty());
232+
///
233+
/// // print 1, 2, 3 in an arbitrary order
234+
/// for i in set.drain() {
235+
/// println!("{}", i);
236+
/// }
237+
///
238+
/// assert!(set.is_empty());
239+
/// ```
240+
#[inline]
241+
#[stable(feature = "drain", since = "1.6.0")]
242+
pub fn drain(&mut self) -> Drain<T> {
243+
Drain { iter: self.map.drain() }
244+
}
245+
246+
/// Clears the set, removing all values.
247+
///
248+
/// # Examples
249+
///
250+
/// ```
251+
/// use std::collections::HashSet;
252+
///
253+
/// let mut v = HashSet::new();
254+
/// v.insert(1);
255+
/// v.clear();
256+
/// assert!(v.is_empty());
257+
/// ```
258+
#[stable(feature = "rust1", since = "1.0.0")]
259+
pub fn clear(&mut self) {
260+
self.map.clear()
261+
}
262+
}
263+
152264
impl<T, S> HashSet<T, S>
153265
where T: Eq + Hash,
154266
S: BuildHasher
@@ -225,21 +337,6 @@ impl<T, S> HashSet<T, S>
225337
self.map.hasher()
226338
}
227339

228-
/// Returns the number of elements the set can hold without reallocating.
229-
///
230-
/// # Examples
231-
///
232-
/// ```
233-
/// use std::collections::HashSet;
234-
/// let set: HashSet<i32> = HashSet::with_capacity(100);
235-
/// assert!(set.capacity() >= 100);
236-
/// ```
237-
#[inline]
238-
#[stable(feature = "rust1", since = "1.0.0")]
239-
pub fn capacity(&self) -> usize {
240-
self.map.capacity()
241-
}
242-
243340
/// Reserves capacity for at least `additional` more elements to be inserted
244341
/// in the `HashSet`. The collection may reserve more space to avoid
245342
/// frequent reallocations.
@@ -310,27 +407,6 @@ impl<T, S> HashSet<T, S>
310407
self.map.shrink_to(min_capacity)
311408
}
312409

313-
/// An iterator visiting all elements in arbitrary order.
314-
/// The iterator element type is `&'a T`.
315-
///
316-
/// # Examples
317-
///
318-
/// ```
319-
/// use std::collections::HashSet;
320-
/// let mut set = HashSet::new();
321-
/// set.insert("a");
322-
/// set.insert("b");
323-
///
324-
/// // Will print in an arbitrary order.
325-
/// for x in set.iter() {
326-
/// println!("{}", x);
327-
/// }
328-
/// ```
329-
#[stable(feature = "rust1", since = "1.0.0")]
330-
pub fn iter(&self) -> Iter<T> {
331-
Iter { iter: self.map.keys() }
332-
}
333-
334410
/// Visits the values representing the difference,
335411
/// i.e., the values that are in `self` but not in `other`.
336412
///
@@ -454,80 +530,6 @@ impl<T, S> HashSet<T, S>
454530
}
455531
}
456532

457-
/// Returns the number of elements in the set.
458-
///
459-
/// # Examples
460-
///
461-
/// ```
462-
/// use std::collections::HashSet;
463-
///
464-
/// let mut v = HashSet::new();
465-
/// assert_eq!(v.len(), 0);
466-
/// v.insert(1);
467-
/// assert_eq!(v.len(), 1);
468-
/// ```
469-
#[stable(feature = "rust1", since = "1.0.0")]
470-
pub fn len(&self) -> usize {
471-
self.map.len()
472-
}
473-
474-
/// Returns `true` if the set contains no elements.
475-
///
476-
/// # Examples
477-
///
478-
/// ```
479-
/// use std::collections::HashSet;
480-
///
481-
/// let mut v = HashSet::new();
482-
/// assert!(v.is_empty());
483-
/// v.insert(1);
484-
/// assert!(!v.is_empty());
485-
/// ```
486-
#[stable(feature = "rust1", since = "1.0.0")]
487-
pub fn is_empty(&self) -> bool {
488-
self.map.is_empty()
489-
}
490-
491-
/// Clears the set, returning all elements in an iterator.
492-
///
493-
/// # Examples
494-
///
495-
/// ```
496-
/// use std::collections::HashSet;
497-
///
498-
/// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
499-
/// assert!(!set.is_empty());
500-
///
501-
/// // print 1, 2, 3 in an arbitrary order
502-
/// for i in set.drain() {
503-
/// println!("{}", i);
504-
/// }
505-
///
506-
/// assert!(set.is_empty());
507-
/// ```
508-
#[inline]
509-
#[stable(feature = "drain", since = "1.6.0")]
510-
pub fn drain(&mut self) -> Drain<T> {
511-
Drain { iter: self.map.drain() }
512-
}
513-
514-
/// Clears the set, removing all values.
515-
///
516-
/// # Examples
517-
///
518-
/// ```
519-
/// use std::collections::HashSet;
520-
///
521-
/// let mut v = HashSet::new();
522-
/// v.insert(1);
523-
/// v.clear();
524-
/// assert!(v.is_empty());
525-
/// ```
526-
#[stable(feature = "rust1", since = "1.0.0")]
527-
pub fn clear(&mut self) {
528-
self.map.clear()
529-
}
530-
531533
/// Returns `true` if the set contains a value.
532534
///
533535
/// The value may be any borrowed form of the set's value type, but
@@ -1066,10 +1068,7 @@ pub struct Union<'a, T: 'a, S: 'a> {
10661068
}
10671069

10681070
#[stable(feature = "rust1", since = "1.0.0")]
1069-
impl<'a, T, S> IntoIterator for &'a HashSet<T, S>
1070-
where T: Eq + Hash,
1071-
S: BuildHasher
1072-
{
1071+
impl<'a, T, S> IntoIterator for &'a HashSet<T, S> {
10731072
type Item = &'a T;
10741073
type IntoIter = Iter<'a, T>;
10751074

@@ -1079,10 +1078,7 @@ impl<'a, T, S> IntoIterator for &'a HashSet<T, S>
10791078
}
10801079

10811080
#[stable(feature = "rust1", since = "1.0.0")]
1082-
impl<T, S> IntoIterator for HashSet<T, S>
1083-
where T: Eq + Hash,
1084-
S: BuildHasher
1085-
{
1081+
impl<T, S> IntoIterator for HashSet<T, S> {
10861082
type Item = T;
10871083
type IntoIter = IntoIter<T>;
10881084

‎src/libsyntax_ext/proc_macro_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec<Self>)>
6969
};
7070

7171
macro_rules! tt {
72-
($ty:ident { $($field:ident $(: $value:expr)*),+ $(,)* }) => (
72+
($ty:ident { $($field:ident $(: $value:expr)*),+ $(,)? }) => (
7373
TokenTree::$ty(self::$ty {
7474
$($field $(: $value)*,)*
7575
span,

‎src/libterm/terminfo/parser/compiled.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use super::super::TermInfo;
99

1010
// These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable.
1111

12-
#[rustfmt_skip]
12+
#[rustfmt::skip]
1313
pub static boolfnames: &[&str] = &["auto_left_margin", "auto_right_margin",
1414
"no_esc_ctlc", "ceol_standout_glitch", "eat_newline_glitch", "erase_overstrike", "generic_type",
1515
"hard_copy", "has_meta_key", "has_status_line", "insert_null_glitch", "memory_above",
@@ -22,13 +22,13 @@ pub static boolfnames: &[&str] = &["auto_left_margin", "auto_right_margin",
2222
"no_correctly_working_cr", "gnu_has_meta_key", "linefeed_is_newline", "has_hardware_tabs",
2323
"return_does_clr_eol"];
2424

25-
#[rustfmt_skip]
25+
#[rustfmt::skip]
2626
pub static boolnames: &[&str] = &["bw", "am", "xsb", "xhp", "xenl", "eo",
2727
"gn", "hc", "km", "hs", "in", "db", "da", "mir", "msgr", "os", "eslok", "xt", "hz", "ul", "xon",
2828
"nxon", "mc5i", "chts", "nrrmc", "npc", "ndscr", "ccc", "bce", "hls", "xhpa", "crxm", "daisy",
2929
"xvpa", "sam", "cpix", "lpix", "OTbs", "OTns", "OTnc", "OTMT", "OTNL", "OTpt", "OTxr"];
3030

31-
#[rustfmt_skip]
31+
#[rustfmt::skip]
3232
pub static numfnames: &[&str] = &[ "columns", "init_tabs", "lines",
3333
"lines_of_memory", "magic_cookie_glitch", "padding_baud_rate", "virtual_terminal",
3434
"width_status_line", "num_labels", "label_height", "label_width", "max_attributes",
@@ -39,13 +39,13 @@ pub static numfnames: &[&str] = &[ "columns", "init_tabs", "lines",
3939
"bit_image_entwining", "bit_image_type", "magic_cookie_glitch_ul", "carriage_return_delay",
4040
"new_line_delay", "backspace_delay", "horizontal_tab_delay", "number_of_function_keys"];
4141

42-
#[rustfmt_skip]
42+
#[rustfmt::skip]
4343
pub static numnames: &[&str] = &[ "cols", "it", "lines", "lm", "xmc", "pb",
4444
"vt", "wsl", "nlab", "lh", "lw", "ma", "wnum", "colors", "pairs", "ncv", "bufsz", "spinv",
4545
"spinh", "maddr", "mjump", "mcs", "mls", "npins", "orc", "orl", "orhi", "orvi", "cps", "widcs",
4646
"btns", "bitwin", "bitype", "UTug", "OTdC", "OTdN", "OTdB", "OTdT", "OTkn"];
4747

48-
#[rustfmt_skip]
48+
#[rustfmt::skip]
4949
pub static stringfnames: &[&str] = &[ "back_tab", "bell", "carriage_return",
5050
"change_scroll_region", "clear_all_tabs", "clear_screen", "clr_eol", "clr_eos",
5151
"column_address", "command_character", "cursor_address", "cursor_down", "cursor_home",
@@ -119,7 +119,7 @@ pub static stringfnames: &[&str] = &[ "back_tab", "bell", "carriage_return",
119119
"acs_lrcorner", "acs_ltee", "acs_rtee", "acs_btee", "acs_ttee", "acs_hline", "acs_vline",
120120
"acs_plus", "memory_lock", "memory_unlock", "box_chars_1"];
121121

122-
#[rustfmt_skip]
122+
#[rustfmt::skip]
123123
pub static stringnames: &[&str] = &[ "cbt", "_", "cr", "csr", "tbc", "clear",
124124
"_", "_", "hpa", "cmdch", "cup", "cud1", "home", "civis", "cub1", "mrcup", "cnorm", "cuf1",
125125
"ll", "cuu1", "cvvis", "dch1", "dl1", "dsl", "hd", "smacs", "blink", "bold", "smcup", "smdc",

‎src/test/ui/issues/issue-35677.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use std::collections::HashMap;
2-
fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool {
3-
this.drain()
1+
use std::collections::HashSet;
2+
3+
fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool {
4+
this.is_subset(other)
45
//~^ ERROR no method named
56
}
67

‎src/test/ui/issues/issue-35677.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap<K, V>` in the current scope
2-
--> $DIR/issue-35677.rs:3:10
1+
error[E0599]: no method named `is_subset` found for type `&std::collections::HashSet<T>` in the current scope
2+
--> $DIR/issue-35677.rs:4:10
33
|
4-
LL | this.drain()
5-
| ^^^^^
4+
LL | this.is_subset(other)
5+
| ^^^^^^^^^
66
|
7-
= note: the method `drain` exists but the following trait bounds were not satisfied:
8-
`K : std::cmp::Eq`
9-
`K : std::hash::Hash`
7+
= note: the method `is_subset` exists but the following trait bounds were not satisfied:
8+
`T : std::cmp::Eq`
9+
`T : std::hash::Hash`
1010

1111
error: aborting due to previous error
1212

0 commit comments

Comments
 (0)
Please sign in to comment.