From f9590af135a05cb81b919dcd478bdb0df92135c9 Mon Sep 17 00:00:00 2001
From: Logan Darklock <logandarklock@gmail.com>
Date: Sun, 23 Aug 2020 16:16:37 -0700
Subject: [PATCH 1/3] thiserror > failure

---
 iui/Cargo.toml   |  2 +-
 iui/src/error.rs | 14 ++++----------
 iui/src/lib.rs   |  2 +-
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/iui/Cargo.toml b/iui/Cargo.toml
index 1473a8df0..e273e67ee 100644
--- a/iui/Cargo.toml
+++ b/iui/Cargo.toml
@@ -38,7 +38,7 @@ maintenance = { status = "actively-developed" }
 [dependencies]
 bitflags = "1"
 libc = "0.2"
-failure = "0.1"
+thiserror = "1.0.20"
 ui-sys = { path = "../ui-sys", version = "0.2.1" }
 regex = "1"
 lazy_static = "1"
diff --git a/iui/src/error.rs b/iui/src/error.rs
index 3820d979d..cbd1489eb 100644
--- a/iui/src/error.rs
+++ b/iui/src/error.rs
@@ -1,22 +1,16 @@
 //! Error types for this crate.
 
 /// The error type returned by functions in this crate which might fail.
-#[derive(Fail, Debug)]
+#[derive(thiserror::Error, Debug)]
 pub enum UIError {
     /// Signifies that the underlying library was unable to properly hook into the platform's GUI APIs.
-    #[fail(
-        display = "unable to initialize the underlying system bindings: {}",
-        error
-    )]
+    #[error("unable to initialize the underlying system bindings: {error}")]
     FailedInitError { error: String },
     /// Signifies that an attempt was made to initialize a new instance of the underlying library while
     /// one already existed.
-    #[fail(display = "cannot initialize multiple instances of the libui toolkit")]
+    #[error("cannot initialize multiple instances of the libui toolkit")]
     MultipleInitError(),
     /// Signifies that an attempt was made to remove a tab from a tab group that was out of bounds.
-    #[fail(
-        display = "cannot remove index {} from tab group: there are only {} tabs in the group",
-        index, n
-    )]
+    #[error("cannot remove index {index} from tab group: there are only {n} tabs in the group")]
     TabGroupIndexOutOfBounds { index: i32, n: i32 },
 }
diff --git a/iui/src/lib.rs b/iui/src/lib.rs
index f557aa161..caceb7bb4 100644
--- a/iui/src/lib.rs
+++ b/iui/src/lib.rs
@@ -20,7 +20,7 @@
 #[macro_use]
 extern crate bitflags;
 #[macro_use]
-extern crate failure;
+extern crate thiserror;
 #[macro_use]
 extern crate lazy_static;
 extern crate libc;

From 791f71126b6bfc0252d0b88f8c88bd4c6a86fb08 Mon Sep 17 00:00:00 2001
From: Logan Darklock <logandarklock@gmail.com>
Date: Sun, 23 Aug 2020 16:18:45 -0700
Subject: [PATCH 2/3] Remove unnecessary `extern crate`

---
 iui/src/lib.rs | 2 --
 1 file changed, 2 deletions(-)

diff --git a/iui/src/lib.rs b/iui/src/lib.rs
index caceb7bb4..260275db7 100644
--- a/iui/src/lib.rs
+++ b/iui/src/lib.rs
@@ -20,8 +20,6 @@
 #[macro_use]
 extern crate bitflags;
 #[macro_use]
-extern crate thiserror;
-#[macro_use]
 extern crate lazy_static;
 extern crate libc;
 extern crate regex;

From 59311234059794f15e487b7006df80af90c74e54 Mon Sep 17 00:00:00 2001
From: Logan Darklock <logandarklock@gmail.com>
Date: Mon, 24 Aug 2020 20:46:35 -0700
Subject: [PATCH 3/3] Add `extern crate` back to follow surrounding convention

---
 iui/src/lib.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iui/src/lib.rs b/iui/src/lib.rs
index 260275db7..97ffd6095 100644
--- a/iui/src/lib.rs
+++ b/iui/src/lib.rs
@@ -19,6 +19,7 @@
 
 #[macro_use]
 extern crate bitflags;
+extern crate thiserror;
 #[macro_use]
 extern crate lazy_static;
 extern crate libc;