Skip to content

Commit b7af067

Browse files
author
Jorge Aparicio
committed
libsyntax: remove unnecessary to_string() calls
1 parent b17c3a1 commit b7af067

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/libsyntax/codemap.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,11 @@ mod test {
614614
let cm = init_code_map();
615615

616616
let fmabp1 = cm.lookup_byte_offset(BytePos(22));
617-
assert_eq!(fmabp1.fm.name, "blork.rs".to_string());
617+
assert_eq!(fmabp1.fm.name, "blork.rs");
618618
assert_eq!(fmabp1.pos, BytePos(22));
619619

620620
let fmabp2 = cm.lookup_byte_offset(BytePos(24));
621-
assert_eq!(fmabp2.fm.name, "blork2.rs".to_string());
621+
assert_eq!(fmabp2.fm.name, "blork2.rs");
622622
assert_eq!(fmabp2.pos, BytePos(0));
623623
}
624624

@@ -640,12 +640,12 @@ mod test {
640640
let cm = init_code_map();
641641

642642
let loc1 = cm.lookup_char_pos(BytePos(22));
643-
assert_eq!(loc1.file.name, "blork.rs".to_string());
643+
assert_eq!(loc1.file.name, "blork.rs");
644644
assert_eq!(loc1.line, 2);
645645
assert_eq!(loc1.col, CharPos(10));
646646

647647
let loc2 = cm.lookup_char_pos(BytePos(24));
648-
assert_eq!(loc2.file.name, "blork2.rs".to_string());
648+
assert_eq!(loc2.file.name, "blork2.rs");
649649
assert_eq!(loc2.line, 1);
650650
assert_eq!(loc2.col, CharPos(0));
651651
}
@@ -701,7 +701,7 @@ mod test {
701701
let span = Span {lo: BytePos(12), hi: BytePos(23), expn_id: NO_EXPANSION};
702702
let file_lines = cm.span_to_lines(span);
703703

704-
assert_eq!(file_lines.file.name, "blork.rs".to_string());
704+
assert_eq!(file_lines.file.name, "blork.rs");
705705
assert_eq!(file_lines.lines.len(), 1);
706706
assert_eq!(file_lines.lines[0], 1u);
707707
}
@@ -723,6 +723,6 @@ mod test {
723723
let span = Span {lo: BytePos(12), hi: BytePos(23), expn_id: NO_EXPANSION};
724724
let sstr = cm.span_to_string(span);
725725

726-
assert_eq!(sstr, "blork.rs:2:1: 2:12".to_string());
726+
assert_eq!(sstr, "blork.rs:2:1: 2:12");
727727
}
728728
}

src/libsyntax/parse/lexer/comments.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -389,41 +389,41 @@ mod test {
389389
#[test] fn test_block_doc_comment_1() {
390390
let comment = "/**\n * Test \n ** Test\n * Test\n*/";
391391
let stripped = strip_doc_comment_decoration(comment);
392-
assert_eq!(stripped, " Test \n* Test\n Test".to_string());
392+
assert_eq!(stripped, " Test \n* Test\n Test");
393393
}
394394

395395
#[test] fn test_block_doc_comment_2() {
396396
let comment = "/**\n * Test\n * Test\n*/";
397397
let stripped = strip_doc_comment_decoration(comment);
398-
assert_eq!(stripped, " Test\n Test".to_string());
398+
assert_eq!(stripped, " Test\n Test");
399399
}
400400

401401
#[test] fn test_block_doc_comment_3() {
402402
let comment = "/**\n let a: *int;\n *a = 5;\n*/";
403403
let stripped = strip_doc_comment_decoration(comment);
404-
assert_eq!(stripped, " let a: *int;\n *a = 5;".to_string());
404+
assert_eq!(stripped, " let a: *int;\n *a = 5;");
405405
}
406406

407407
#[test] fn test_block_doc_comment_4() {
408408
let comment = "/*******************\n test\n *********************/";
409409
let stripped = strip_doc_comment_decoration(comment);
410-
assert_eq!(stripped, " test".to_string());
410+
assert_eq!(stripped, " test");
411411
}
412412

413413
#[test] fn test_line_doc_comment() {
414414
let stripped = strip_doc_comment_decoration("/// test");
415-
assert_eq!(stripped, " test".to_string());
415+
assert_eq!(stripped, " test");
416416
let stripped = strip_doc_comment_decoration("///! test");
417-
assert_eq!(stripped, " test".to_string());
417+
assert_eq!(stripped, " test");
418418
let stripped = strip_doc_comment_decoration("// test");
419-
assert_eq!(stripped, " test".to_string());
419+
assert_eq!(stripped, " test");
420420
let stripped = strip_doc_comment_decoration("// test");
421-
assert_eq!(stripped, " test".to_string());
421+
assert_eq!(stripped, " test");
422422
let stripped = strip_doc_comment_decoration("///test");
423-
assert_eq!(stripped, "test".to_string());
423+
assert_eq!(stripped, "test");
424424
let stripped = strip_doc_comment_decoration("///!test");
425-
assert_eq!(stripped, "test".to_string());
425+
assert_eq!(stripped, "test");
426426
let stripped = strip_doc_comment_decoration("//test");
427-
assert_eq!(stripped, "test".to_string());
427+
assert_eq!(stripped, "test");
428428
}
429429
}

src/libsyntax/parse/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ mod test {
954954
}\
955955
]\
956956
}\
957-
]".to_string()
957+
]"
958958
);
959959
}
960960

src/libsyntax/print/pprust.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2961,9 +2961,9 @@ mod test {
29612961
variadic: false
29622962
};
29632963
let generics = ast_util::empty_generics();
2964-
assert_eq!(&fun_to_string(&decl, ast::NormalFn, abba_ident,
2964+
assert_eq!(fun_to_string(&decl, ast::NormalFn, abba_ident,
29652965
None, &generics),
2966-
&"fn abba()".to_string());
2966+
"fn abba()");
29672967
}
29682968

29692969
#[test]
@@ -2981,7 +2981,7 @@ mod test {
29812981
});
29822982

29832983
let varstr = variant_to_string(&var);
2984-
assert_eq!(&varstr,&"pub principal_skinner".to_string());
2984+
assert_eq!(varstr, "pub principal_skinner");
29852985
}
29862986

29872987
#[test]

0 commit comments

Comments
 (0)