1use super::*;
2
3impl std::cmp::PartialEq for EdError {
4 fn eq(&self, other: &Self) -> bool {
5 use EdError::*;
6 match (self, other) {
7 (Internal(x),Internal(y)) => x == y,
8 (IO(_),IO(_)) => true,
9 (UI(_),UI(_)) => true,
10
11 (InfiniteRecursion, InfiniteRecursion) => true,
12
13 (
14 IndexTooBig{index: a, buffer_len: b},
15 IndexTooBig{index: c, buffer_len: d},
16 ) => {
17 a == c && b == d
18 },
19 (Line0Invalid,Line0Invalid) => true,
20 (SelectionEmpty((a,b)),SelectionEmpty((c,d))) => a == c && b == d,
21 (SelectionForbidden,SelectionForbidden) => true,
22
23 (UnsavedChanges,UnsavedChanges) => true,
24 (NoOp,NoOp) => true,
25 (
26 UndoIndexTooBig{index: a, history_len: b, relative_redo_limit: c},
27 UndoIndexTooBig{index: d, history_len: e, relative_redo_limit: f},
28 ) => {
29 a == d && b == e && c == f
30 },
31 (CommandEscapeForbidden(x),CommandEscapeForbidden(y)) => x == y,
32 (TagInvalid(x),TagInvalid(y)) => x == y,
33 (TagNoMatch(x),TagNoMatch(y)) => x == y,
34 (
35 RegexInvalid{regex: a, error: b},
36 RegexInvalid{regex: c, error: d},
37 ) => {
38 a == c && b == d
39 },
40 (RegexNoMatch(x),RegexNoMatch(y)) => x == y,
41 (PrintAfterWipe,PrintAfterWipe) => true,
42
43 (DefaultFileUnset,DefaultFileUnset) => true,
44 (DefaultShellCommandUnset,DefaultShellCommandUnset) => true,
45 (DefaultSArgsUnset,DefaultSArgsUnset) => true,
46
47 (
48 IndexSpecialAfterStart{prior_index: a, special_index: b},
49 IndexSpecialAfterStart{prior_index: c, special_index: d},
50 ) => {
51 a == c && b == d
52 },
53 (IndexNotInt(x),IndexNotInt(y)) => x == y,
54 (OffsetNotInt(x),OffsetNotInt(y)) => x == y,
55 (
56 IndicesUnrelated{prior_index: a, unrelated_index: b},
57 IndicesUnrelated{prior_index: c, unrelated_index: d},
58 ) => {
59 a == c && b == d
60 },
61 (IndexUnfinished(x),IndexUnfinished(y)) => x == y,
62
63 (CommandUndefined(x),CommandUndefined(y)) => x == y,
64 (ArgumentListEscapedEnd(x),ArgumentListEscapedEnd(y)) => x == y,
65 (
66 ArgumentsWrongNr{expected: a, received: b},
67 ArgumentsWrongNr{expected: c, received: d},
68 ) => {
69 a == c && b == d
70 },
71 (ScrollNotInt(x),ScrollNotInt(y)) => x == y,
72 (UndoStepsNotInt(x),UndoStepsNotInt(y)) => x == y,
73 (ReflowNotInt{error: a, text: b},ReflowNotInt{error: c, text: d}) => {
74 a == c && b == d
75 },
76 (MacroUndefined(x),MacroUndefined(y)) => x == y,
77
78 (FlagDuplicate(x),FlagDuplicate(y)) => x == y,
79 (FlagUndefined(x),FlagUndefined(y)) => x == y,
80
81 _ => false,
82 }
83 }
84}