unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 6b830ecf94a4171adb0682e6142c23247a93b326 4279 bytes (raw)
name: gnu/packages/patches/fractal-switch-from-failure-to-anyhow.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
 
From e4ca9dc5c0f4401f350338e4cd9b0734db9371bf Mon Sep 17 00:00:00 2001
From: Yuki Okushi <huyuumi.dev@gmail.com>
Date: Thu, 13 Aug 2020 14:41:50 +0900
Subject: [PATCH] Switch from failure to anyhow

---
 Cargo.lock                      | 8 +++++++-
 fractal-gtk/Cargo.toml          | 2 +-
 fractal-gtk/src/appop/attach.rs | 2 +-
 fractal-gtk/src/cache/mod.rs    | 2 +-
 fractal-gtk/src/cache/state.rs  | 7 +++----
 fractal-gtk/src/util.rs         | 8 ++++----
 6 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index c0b5e5e2..f26d9787 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -88,6 +88,12 @@ dependencies = [
  "winapi 0.3.9",
 ]
 
+[[package]]
+name = "anyhow"
+version = "1.0.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b"
+
 [[package]]
 name = "arrayref"
 version = "0.3.6"
@@ -580,6 +586,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
 name = "fractal-gtk"
 version = "4.4.0"
 dependencies = [
+ "anyhow",
  "cairo-rs",
  "chrono",
  "clap",
@@ -587,7 +594,6 @@ dependencies = [
  "directories",
  "dirs",
  "either 1.5.99",
- "failure",
  "fractal-matrix-api",
  "fragile",
  "gdk",
diff --git a/fractal-gtk/Cargo.toml b/fractal-gtk/Cargo.toml
index 960f64b5..e1c6a33d 100644
--- a/fractal-gtk/Cargo.toml
+++ b/fractal-gtk/Cargo.toml
@@ -6,11 +6,11 @@ workspace = "../"
 edition = "2018"
 
 [dependencies]
+anyhow = "1.0.32"
 clap = "2.33.0"
 comrak = "0.7.0"
 directories = "2.0.2"
 dirs = "2.0.2"
-failure = "0.1.6"
 fragile = "1.0.0"
 gspell = "0.4.0"
 gdk = "0.12.1"
diff --git a/fractal-gtk/src/appop/attach.rs b/fractal-gtk/src/appop/attach.rs
index 3f0813aa..3b5bff4c 100644
--- a/fractal-gtk/src/appop/attach.rs
+++ b/fractal-gtk/src/appop/attach.rs
@@ -6,7 +6,7 @@ use std::io::prelude::*;
 use std::path::PathBuf;
 use std::sync::{Arc, Mutex};
 
-use failure::Error;
+use anyhow::Error;
 
 use gtk::prelude::*;
 
diff --git a/fractal-gtk/src/cache/mod.rs b/fractal-gtk/src/cache/mod.rs
index 76942866..8943eac6 100644
--- a/fractal-gtk/src/cache/mod.rs
+++ b/fractal-gtk/src/cache/mod.rs
@@ -12,7 +12,7 @@ use std::thread;
 
 use crate::types::Room;
 use crate::types::RoomList;
-use failure::Error;
+use anyhow::Error;
 use fractal_api::identifiers::{DeviceId, UserId};
 use std::collections::HashMap;
 use std::hash::Hash;
diff --git a/fractal-gtk/src/cache/state.rs b/fractal-gtk/src/cache/state.rs
index 7cb5372a..0e62c59b 100644
--- a/fractal-gtk/src/cache/state.rs
+++ b/fractal-gtk/src/cache/state.rs
@@ -4,8 +4,7 @@ use mdl::Model;
 use mdl::Store;
 use serde::{Deserialize, Serialize};
 
-use failure::err_msg;
-use failure::Error;
+use anyhow::{anyhow, Error};
 
 use std::cell::RefCell;
 use std::fs::remove_dir_all;
@@ -127,8 +126,8 @@ impl FCache {
         guard.take();
 
         let fname = cache_dir_path(None, "cache.mdl")
-            .or_else(|_| Err(err_msg("Can't remove cache file")))?;
-        remove_dir_all(fname).or_else(|_| Err(err_msg("Can't remove cache file")))
+            .or_else(|_| Err(anyhow!("Can't remove cache file")))?;
+        remove_dir_all(fname).or_else(|_| Err(anyhow!("Can't remove cache file")))
     }
 
     #[allow(dead_code)]
diff --git a/fractal-gtk/src/util.rs b/fractal-gtk/src/util.rs
index 764a8e8e..b2feb12c 100644
--- a/fractal-gtk/src/util.rs
+++ b/fractal-gtk/src/util.rs
@@ -1,6 +1,6 @@
 use crate::globals::CACHE_PATH;
-use failure::format_err;
-use failure::Error as FailError;
+use anyhow::anyhow;
+use anyhow::Error as AnyhowError;
 use gdk::prelude::*;
 use gdk_pixbuf::Pixbuf;
 use gio::{Settings, SettingsExt, SettingsSchemaSource};
@@ -21,9 +21,9 @@ pub fn cache_dir_path(dir: Option<&str>, name: &str) -> Result<PathBuf, IoError>
     Ok(path.join(name))
 }
 
-pub fn get_pixbuf_data(pb: &Pixbuf) -> Result<Vec<u8>, FailError> {
+pub fn get_pixbuf_data(pb: &Pixbuf) -> Result<Vec<u8>, AnyhowError> {
     let image = cairo::ImageSurface::create(cairo::Format::ARgb32, pb.get_width(), pb.get_height())
-        .or_else(|_| Err(format_err!("Cairo Error")))?;
+        .or_else(|_| Err(anyhow!("Cairo Error")))?;
 
     let g = cairo::Context::new(&image);
     g.set_source_pixbuf(pb, 0.0, 0.0);
-- 
2.30.1


debug log:

solving 6b830ecf94 ...
found 6b830ecf94 in https://yhetil.org/guix-patches/20210224123047.31315-52-leo.prikler@student.tugraz.at/ ||
	https://yhetil.org/guix-patches/20210311220756.23132-47-leo.prikler@student.tugraz.at/ ||
	https://yhetil.org/guix-patches/20210307173459.3048-46-leo.prikler@student.tugraz.at/ ||
	https://yhetil.org/guix-patches/20210301101113.29696-3-leo.prikler@student.tugraz.at/ ||
	https://yhetil.org/guix-patches/20210317202735.14024-51-leo.prikler@student.tugraz.at/ ||
	https://yhetil.org/guix-patches/20210315175838.1931-51-leo.prikler@student.tugraz.at/

applying [1/1] https://yhetil.org/guix-patches/20210224123047.31315-52-leo.prikler@student.tugraz.at/
diff --git a/gnu/packages/patches/fractal-switch-from-failure-to-anyhow.patch b/gnu/packages/patches/fractal-switch-from-failure-to-anyhow.patch
new file mode 100644
index 0000000000..6b830ecf94

1:28: trailing whitespace.
 
1:60: trailing whitespace.
 
1:78: trailing whitespace.
 
1:81: trailing whitespace.
 
1:83: trailing whitespace.
 
Checking patch gnu/packages/patches/fractal-switch-from-failure-to-anyhow.patch...
Applied patch gnu/packages/patches/fractal-switch-from-failure-to-anyhow.patch cleanly.
warning: squelched 9 whitespace errors
warning: 14 lines add whitespace errors.

skipping https://yhetil.org/guix-patches/20210311220756.23132-47-leo.prikler@student.tugraz.at/ for 6b830ecf94
skipping https://yhetil.org/guix-patches/20210307173459.3048-46-leo.prikler@student.tugraz.at/ for 6b830ecf94
skipping https://yhetil.org/guix-patches/20210301101113.29696-3-leo.prikler@student.tugraz.at/ for 6b830ecf94
skipping https://yhetil.org/guix-patches/20210317202735.14024-51-leo.prikler@student.tugraz.at/ for 6b830ecf94
skipping https://yhetil.org/guix-patches/20210315175838.1931-51-leo.prikler@student.tugraz.at/ for 6b830ecf94
index at:
100644 6b830ecf94a4171adb0682e6142c23247a93b326	gnu/packages/patches/fractal-switch-from-failure-to-anyhow.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).