about summary refs log tree commit diff
path: root/compiler/rustc_expand/src/tokenstream/tests.rs
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2021-03-16 01:50:34 -0400
committerJoshua Nelson <jyn514@gmail.com>2021-03-27 22:16:33 -0400
commit441dc3640a408e612064464b0c6308bdca6c16ce (patch)
tree15e0bbd467ae94a5993efa451354076c396b4809 /compiler/rustc_expand/src/tokenstream/tests.rs
parent785aeac521e54da8c6826396d05446227e19ee40 (diff)
downloadrust-441dc3640a408e612064464b0c6308bdca6c16ce.tar.gz
rust-441dc3640a408e612064464b0c6308bdca6c16ce.zip
Remove (lots of) dead code
Found with https://github.com/est31/warnalyzer.

Dubious changes:
- Is anyone else using rustc_apfloat? I feel weird completely deleting
  x87 support.
- Maybe some of the dead code in rustc_data_structures, in case someone
  wants to use it in the future?
- Don't change rustc_serialize

  I plan to scrap most of the json module in the near future (see
  https://github.com/rust-lang/compiler-team/issues/418) and fixing the
  tests needed more work than I expected.

TODO: check if any of the comments on the deleted code should be kept.
Diffstat (limited to 'compiler/rustc_expand/src/tokenstream/tests.rs')
-rw-r--r--compiler/rustc_expand/src/tokenstream/tests.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_expand/src/tokenstream/tests.rs b/compiler/rustc_expand/src/tokenstream/tests.rs
index 4e818e9feb0..8b546e7e4a3 100644
--- a/compiler/rustc_expand/src/tokenstream/tests.rs
+++ b/compiler/rustc_expand/src/tokenstream/tests.rs
@@ -1,7 +1,7 @@
 use crate::tests::string_to_stream;
 
 use rustc_ast::token;
-use rustc_ast::tokenstream::{TokenStream, TokenStreamBuilder, TokenTree};
+use rustc_ast::tokenstream::{Spacing, TokenStream, TokenStreamBuilder, TokenTree};
 use rustc_span::with_default_session_globals;
 use rustc_span::{BytePos, Span, Symbol};
 use smallvec::smallvec;
@@ -14,6 +14,10 @@ fn sp(a: u32, b: u32) -> Span {
     Span::with_root_ctxt(BytePos(a), BytePos(b))
 }
 
+fn joint(tree: TokenTree) -> TokenStream {
+    TokenStream::new(vec![(tree, Spacing::Joint)])
+}
+
 #[test]
 fn test_concat() {
     with_default_session_globals(|| {
@@ -99,8 +103,8 @@ fn test_is_empty() {
 fn test_dotdotdot() {
     with_default_session_globals(|| {
         let mut builder = TokenStreamBuilder::new();
-        builder.push(TokenTree::token(token::Dot, sp(0, 1)).joint());
-        builder.push(TokenTree::token(token::Dot, sp(1, 2)).joint());
+        builder.push(joint(TokenTree::token(token::Dot, sp(0, 1))));
+        builder.push(joint(TokenTree::token(token::Dot, sp(1, 2))));
         builder.push(TokenTree::token(token::Dot, sp(2, 3)));
         let stream = builder.build();
         assert!(stream.eq_unspanned(&string_to_ts("...")));