Skip to content

Removed unnecessary method in test #15427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions src/libsyntax/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,7 @@ pub fn maybe_aborted<T>(result: T, mut p: Parser) -> T {
#[cfg(test)]
mod test {
use super::*;
use serialize::{json, Encodable};
use std::io;
use std::io::MemWriter;
use std::mem::transmute;
use std::str;
use serialize::json;
use std::gc::GC;
use codemap::{Span, BytePos, Spanned};
use owned_slice::OwnedSlice;
Expand All @@ -296,16 +292,6 @@ mod test {
use util::parser_testing::{string_to_expr, string_to_item};
use util::parser_testing::string_to_stmt;

fn to_json_str<'a, E: Encodable<json::Encoder<'a>, io::IoError>>(val: &E) -> String {
let mut writer = MemWriter::new();
// FIXME(14302) remove the transmute and unsafe block.
unsafe {
let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer);
let _ = val.encode(transmute(&mut encoder));
}
str::from_utf8(writer.unwrap().as_slice()).unwrap().to_string()
}

// produce a codemap::span
fn sp(a: u32, b: u32) -> Span {
Span{lo:BytePos(a),hi:BytePos(b),expn_info:None}
Expand Down Expand Up @@ -415,7 +401,7 @@ mod test {

#[test] fn string_to_tts_1 () {
let tts = string_to_tts("fn a (b : int) { b; }".to_string());
assert_eq!(to_json_str(&tts),
assert_eq!(json::encode(&tts),
"[\
{\
\"variant\":\"TTTok\",\
Expand Down