We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d697e45 commit 82c1f1cCopy full SHA for 82c1f1c
src/document.rs
@@ -354,12 +354,15 @@ impl KdlDocument {
354
let v2_res = KdlDocument::parse_v2(s);
355
if v2_res.is_err() {
356
let v1_res = KdlDocument::parse_v2(s);
357
- if v1_res.is_err() && detect_v2(s) {
358
- v2_res
359
- } else if detect_v1(s) {
+ if v1_res.is_ok() || detect_v1(s) {
360
v1_res
+ } else if detect_v2(s) {
+ // v2, but with confidence
361
+ v2_res
362
} else {
- // This does matter, because detection short-circuits.
363
+ // TODO(@zkat): maybe we can add something to the error
364
+ // message to specify that it's "uncertain"?
365
+ // YOLO.
366
v2_res
367
}
368
0 commit comments