mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Replace WebIdlError enum with ParentMismatchError struct.
This commit is contained in:
parent
6db7518110
commit
0d3bee28c8
1 changed files with 18 additions and 20 deletions
|
@ -26,32 +26,30 @@ declare_lint!(
|
||||||
pub struct WebIdlPass;
|
pub struct WebIdlPass;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum WebIdlError {
|
pub struct ParentMismatchError {
|
||||||
ParentMismatch {
|
|
||||||
name: String,
|
name: String,
|
||||||
rust_parent: String,
|
rust_parent: String,
|
||||||
webidl_parent: String,
|
webidl_parent: String,
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for WebIdlError {
|
impl fmt::Display for ParentMismatchError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
let ParentMismatchError {
|
||||||
WebIdlError::ParentMismatch {
|
|
||||||
name,
|
name,
|
||||||
rust_parent,
|
rust_parent,
|
||||||
webidl_parent,
|
webidl_parent,
|
||||||
} => {
|
} = self;
|
||||||
return write!(f, "webidl-rust inheritance mismatch, rust: {:?}, rust parent: {:?}, webidl parent: {:?}",
|
write!(
|
||||||
&name, &rust_parent, &webidl_parent);
|
f,
|
||||||
},
|
"webidl-rust inheritance mismatch, rust: {:?}, rust parent: {:?}, webidl parent: {:?}",
|
||||||
}
|
&name, &rust_parent, &webidl_parent
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Error for WebIdlError {
|
impl Error for ParentMismatchError {
|
||||||
fn description(&self) -> &str {
|
fn description(&self) -> &str {
|
||||||
"WebIdlError"
|
"ParentMismatchError"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cause(&self) -> Option<&Error> {
|
fn cause(&self) -> Option<&Error> {
|
||||||
|
@ -126,7 +124,7 @@ fn check_inherits(code: &str, name: &str, parent_name: &str) -> Result<(), Box<E
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(boxed::Box::from(WebIdlError::ParentMismatch {
|
Err(boxed::Box::from(ParentMismatchError {
|
||||||
name: name.to_string(),
|
name: name.to_string(),
|
||||||
rust_parent: parent_name.to_string(),
|
rust_parent: parent_name.to_string(),
|
||||||
webidl_parent: inherits.to_string(),
|
webidl_parent: inherits.to_string(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue