File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,14 @@ impl TokenStream {
118118 }
119119}
120120
121+ /// `TokenStream::default()` returns an empty stream,
122+ /// i.e. this is equivalent with `TokenStream::new()`.
123+ impl Default for TokenStream {
124+ fn default ( ) -> Self {
125+ TokenStream :: new ( )
126+ }
127+ }
128+
121129/// Attempts to break the string into tokens and parse those tokens into a token
122130/// stream.
123131///
Original file line number Diff line number Diff line change @@ -381,3 +381,10 @@ TokenStream [
381381
382382 assert_eq ! ( expected, format!( "{:#?}" , tts) ) ;
383383}
384+
385+ #[ test]
386+ fn default_tokenstream_is_empty ( ) {
387+ let default_token_stream: TokenStream = Default :: default ( ) ;
388+
389+ assert ! ( default_token_stream. is_empty( ) ) ;
390+ }
You can’t perform that action at this time.
0 commit comments