Skip to content

Commit aabe3da

Browse files
committed
Remove unneeded code
1 parent e259707 commit aabe3da

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

src/valid/mod.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,9 @@ pub fn new_compiler<P: AsRef<Path>>(dir: P) -> Result<Compiler, Box<dyn Error>>
6666
let glob = Glob::new("**/*.schema.json")?;
6767
for path in glob.walk(dir) {
6868
let path = path?;
69-
let bn = path.path().display().to_string();
70-
if bn.ends_with(".schema.json") {
71-
let schema: Value = serde_json::from_reader(File::open(path.into_path())?)?;
72-
let s = &schema["$id"].as_str().ok_or(ValidationError::UnknownSpec)?;
73-
compiler.add_resource(s, schema.to_owned())?;
74-
} else {
75-
// println!("Skipping {}", path.display());
76-
}
69+
let schema: Value = serde_json::from_reader(File::open(path.into_path())?)?;
70+
let s = &schema["$id"].as_str().ok_or(ValidationError::UnknownSpec)?;
71+
compiler.add_resource(s, schema.to_owned())?;
7772
}
7873

7974
Ok(compiler)

tests/v1_schema_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ fn test_v1_distribution() -> Result<(), Box<dyn Error>> {
13391339
spec.insert("x_foo".to_string(), json!(1));
13401340
}),
13411341
("multibyte name", |m: &mut Obj| {
1342-
m.insert("name".to_string(), json!("yoŭknow"));
1342+
m.insert("name".to_string(), json!("yoŭ_know"));
13431343
}),
13441344
("emoji name", |m: &mut Obj| {
13451345
m.insert("name".to_string(), json!("📀📟🎱"));

tests/v2_schema_test.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2959,7 +2959,7 @@ fn test_v2_distribution() -> Result<(), Box<dyn Error>> {
29592959
spec.remove("url");
29602960
}),
29612961
("multibyte name", |m: &mut Obj| {
2962-
m.insert("name".to_string(), json!("yoŭknow"));
2962+
m.insert("name".to_string(), json!("_know"));
29632963
}),
29642964
("emoji name", |m: &mut Obj| {
29652965
m.insert("name".to_string(), json!("📀📟🎱"));
@@ -2968,7 +2968,7 @@ fn test_v2_distribution() -> Result<(), Box<dyn Error>> {
29682968
m.insert("name".to_string(), json!("foo-bar"));
29692969
}),
29702970
("multibyte abstract", |m: &mut Obj| {
2971-
m.insert("abstract".to_string(), json!("yoŭknow"));
2971+
m.insert("abstract".to_string(), json!("yoŭ_know"));
29722972
}),
29732973
("emoji abstract", |m: &mut Obj| {
29742974
m.insert("abstract".to_string(), json!("📀📟🎱"));
@@ -3001,13 +3001,13 @@ fn test_v2_distribution() -> Result<(), Box<dyn Error>> {
30013001
m.insert("version".to_string(), json!("1.2.1-beta1"));
30023002
}),
30033003
("multibyte description", |m: &mut Obj| {
3004-
m.insert("description".to_string(), json!("yoŭknow"));
3004+
m.insert("description".to_string(), json!("yoŭ_know"));
30053005
}),
30063006
("emoji description", |m: &mut Obj| {
30073007
m.insert("description".to_string(), json!("📀📟🎱"));
30083008
}),
30093009
("multibyte producer", |m: &mut Obj| {
3010-
m.insert("producer".to_string(), json!("yoŭknow"));
3010+
m.insert("producer".to_string(), json!("yoŭ_know"));
30113011
}),
30123012
("emoji producer", |m: &mut Obj| {
30133013
m.insert("producer".to_string(), json!("📀📟🎱"));

0 commit comments

Comments
 (0)