mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
parent
b5d4421a83
commit
2261947f6e
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1,6 +1,6 @@
|
|||||||
[root]
|
[root]
|
||||||
name = "rustfmt"
|
name = "rustfmt"
|
||||||
version = "0.7.0"
|
version = "0.7.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"diff 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"diff 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -84,6 +84,8 @@ impl<'a> FmtVisitor<'a> {
|
|||||||
let big_diff = (span.lo - big_span_lo).to_usize();
|
let big_diff = (span.lo - big_span_lo).to_usize();
|
||||||
let snippet = self.snippet(span);
|
let snippet = self.snippet(span);
|
||||||
|
|
||||||
|
debug!("write_snippet `{}`", snippet);
|
||||||
|
|
||||||
self.write_snippet_inner(big_snippet, big_diff, &snippet, process_last_snippet);
|
self.write_snippet_inner(big_snippet, big_diff, &snippet, process_last_snippet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +116,8 @@ impl<'a> FmtVisitor<'a> {
|
|||||||
let snippet = &*replaced;
|
let snippet = &*replaced;
|
||||||
|
|
||||||
for (kind, offset, subslice) in CommentCodeSlices::new(snippet) {
|
for (kind, offset, subslice) in CommentCodeSlices::new(snippet) {
|
||||||
|
debug!("{:?}: {:?}", kind, subslice);
|
||||||
|
|
||||||
if let CodeCharKind::Comment = kind {
|
if let CodeCharKind::Comment = kind {
|
||||||
let last_char = big_snippet[..(offset + big_diff)]
|
let last_char = big_snippet[..(offset + big_diff)]
|
||||||
.chars()
|
.chars()
|
||||||
@ -199,6 +203,13 @@ impl<'a> FmtVisitor<'a> {
|
|||||||
last_wspace = None;
|
last_wspace = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let remaining = snippet[line_start..subslice.len() + offset].trim();
|
||||||
|
if !remaining.is_empty() {
|
||||||
|
self.buffer.push_str(remaining);
|
||||||
|
line_start = subslice.len() + offset;
|
||||||
|
rewrite_next_comment = rewrite_next_comment || kind == CodeCharKind::Normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process_last_snippet(self, &snippet[line_start..], snippet);
|
process_last_snippet(self, &snippet[line_start..], snippet);
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(dead_code)] // bar
|
||||||
|
|
||||||
//! Doc comment
|
//! Doc comment
|
||||||
fn test() {
|
fn test() {
|
||||||
// comment
|
// comment
|
||||||
@ -44,3 +46,8 @@ fn debug_function() {
|
|||||||
println!("hello");
|
println!("hello");
|
||||||
}
|
}
|
||||||
// */
|
// */
|
||||||
|
|
||||||
|
#[link_section=".vectors"]
|
||||||
|
#[no_mangle] // Test this attribute is preserved.
|
||||||
|
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
pub static ISSUE_1284: [i32; 16] = [];
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(dead_code)] // bar
|
||||||
|
|
||||||
//! Doc comment
|
//! Doc comment
|
||||||
fn test() {
|
fn test() {
|
||||||
// comment
|
// comment
|
||||||
@ -43,3 +45,8 @@ fn debug_function() {
|
|||||||
println!("hello");
|
println!("hello");
|
||||||
}
|
}
|
||||||
// */
|
// */
|
||||||
|
|
||||||
|
#[link_section=".vectors"]
|
||||||
|
#[no_mangle] // Test this attribute is preserved.
|
||||||
|
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
pub static ISSUE_1284: [i32; 16] = [];
|
||||||
|
@ -86,7 +86,7 @@ fn ______________________baz(a: i32)
|
|||||||
*mut ::std::option::Option<extern "C" fn(arg1: i32,
|
*mut ::std::option::Option<extern "C" fn(arg1: i32,
|
||||||
_____________________a: i32,
|
_____________________a: i32,
|
||||||
arg3: i32)
|
arg3: i32)
|
||||||
-> ()> {
|
-> ()>{
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
pub fn check_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
|
Loading…
Reference in New Issue
Block a user