Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9d52940

Browse files
committed
Run cargo fmt
1 parent 38361c0 commit 9d52940

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

src/config/file_lines.rs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use std::path::PathBuf;
1515
use std::rc::Rc;
1616
use std::{cmp, fmt, iter, str};
1717

18-
use serde::ser::{self, Serialize, Serializer};
1918
use serde::de::{Deserialize, Deserializer};
19+
use serde::ser::{self, Serialize, Serializer};
2020
use serde_json as json;
2121

2222
use syntax::codemap::{self, FileMap};
@@ -75,8 +75,9 @@ impl Serialize for FileName {
7575
{
7676
let s = match self {
7777
FileName::Stdin => Ok("stdin"),
78-
FileName::Real(path) => path.to_str().ok_or_else(||
79-
ser::Error::custom("path can't be serialized as UTF-8 string"))
78+
FileName::Real(path) => path
79+
.to_str()
80+
.ok_or_else(|| ser::Error::custom("path can't be serialized as UTF-8 string")),
8081
};
8182

8283
s.and_then(|s| serializer.serialize_str(s))
@@ -385,29 +386,37 @@ mod test {
385386
);
386387
}
387388

388-
use std::{collections::HashMap, path::PathBuf};
389-
use super::{FileName, FileLines};
390389
use super::json::{self, json, json_internal};
390+
use super::{FileLines, FileName};
391+
use std::{collections::HashMap, path::PathBuf};
391392

392393
#[test]
393394
fn file_lines_to_json() {
394395
let ranges: HashMap<FileName, Vec<Range>> = [
395-
(FileName::Real(PathBuf::from("src/main.rs")), vec![
396-
Range::new(1, 3),
397-
Range::new(5, 7)
398-
]),
399-
(FileName::Real(PathBuf::from("src/lib.rs")), vec![
400-
Range::new(1, 7)
401-
])].iter().cloned().collect();
396+
(
397+
FileName::Real(PathBuf::from("src/main.rs")),
398+
vec![Range::new(1, 3), Range::new(5, 7)],
399+
),
400+
(
401+
FileName::Real(PathBuf::from("src/lib.rs")),
402+
vec![Range::new(1, 7)],
403+
),
404+
]
405+
.iter()
406+
.cloned()
407+
.collect();
402408

403409
let file_lines = FileLines::from_ranges(ranges);
404410
let mut spans = file_lines.to_json_spans();
405411
spans.sort();
406412
let json = json::to_value(&spans).unwrap();
407-
assert_eq!(json, json! {[
408-
{"file": "src/lib.rs", "range": [1, 7]},
409-
{"file": "src/main.rs", "range": [1, 3]},
410-
{"file": "src/main.rs", "range": [5, 7]},
411-
]});
413+
assert_eq!(
414+
json,
415+
json! {[
416+
{"file": "src/lib.rs", "range": [1, 7]},
417+
{"file": "src/main.rs", "range": [1, 3]},
418+
{"file": "src/main.rs", "range": [5, 7]},
419+
]}
420+
);
412421
}
413422
}

0 commit comments

Comments
 (0)