fix lints and update deps

This commit is contained in:
Michael Zhang 2020-12-23 22:46:13 -06:00
parent 36d6192d4f
commit 2372cbb963
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
4 changed files with 18 additions and 45 deletions

40
Cargo.lock generated
View file

@ -153,7 +153,7 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"const_fn", "const_fn",
"crossbeam-utils", "crossbeam-utils",
"lazy_static 1.4.0", "lazy_static",
"memoffset", "memoffset",
"scopeguard", "scopeguard",
] ]
@ -166,7 +166,7 @@ checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"lazy_static 1.4.0", "lazy_static",
] ]
[[package]] [[package]]
@ -242,12 +242,6 @@ dependencies = [
"rayon", "rayon",
] ]
[[package]]
name = "lazy_static"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -442,7 +436,7 @@ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"crossbeam-deque", "crossbeam-deque",
"crossbeam-utils", "crossbeam-utils",
"lazy_static 1.4.0", "lazy_static",
"num_cpus", "num_cpus",
] ]
@ -475,9 +469,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "stderrlog" name = "stderrlog"
version = "0.4.3" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32e5ee9b90a5452c570a0b0ac1c99ae9498db7e56e33d74366de7f2a7add7f25" checksum = "b02f316286ae558d83acc93dd81eaba096e746987a7961d4a9ae026842bae67f"
dependencies = [ dependencies = [
"atty", "atty",
"chrono", "chrono",
@ -499,7 +493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c" checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c"
dependencies = [ dependencies = [
"clap", "clap",
"lazy_static 1.4.0", "lazy_static",
"structopt-derive", "structopt-derive",
] ]
@ -559,12 +553,11 @@ dependencies = [
[[package]] [[package]]
name = "thread_local" name = "thread_local"
version = "0.3.4" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
dependencies = [ dependencies = [
"lazy_static 0.2.11", "lazy_static",
"unreachable",
] ]
[[package]] [[package]]
@ -607,15 +600,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "unreachable"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
dependencies = [
"void",
]
[[package]] [[package]]
name = "vec_map" name = "vec_map"
version = "0.8.2" version = "0.8.2"
@ -628,12 +612,6 @@ version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.10.0+wasi-snapshot-preview1" version = "0.10.0+wasi-snapshot-preview1"

View file

@ -10,8 +10,8 @@ authors = ["Michael Zhang <mail@mzhang.io>"]
[dependencies] [dependencies]
anyhow = "1.0.36" anyhow = "1.0.36"
image = "0.23.12" image = "0.23.12"
log = "0.4.8" log = "0.4.11"
stderrlog = "0.4.3" stderrlog = "0.5.0"
xcb-util = { version = "0.3.0", features = ["image", "cursor"] } xcb-util = { version = "0.3.0", features = ["image", "cursor"] }
xcb = { version = "0.9" } xcb = "0.9.0"
structopt = "0.3.21" structopt = "0.3.21"

View file

@ -1,27 +1,22 @@
use std::path::Path; use std::path::Path;
use std::ptr;
use anyhow::Result; use anyhow::Result;
use image::{Bgra, ColorType, DynamicImage, ImageBuffer}; use image::{Bgra, DynamicImage, ImageBuffer};
use xcb::{ use xcb::{
base::Connection, base::Connection,
xproto::{self, Rectangle}, xproto::{self, Rectangle},
Screen, Screen,
}; };
use xcb_util::{ffi::image::*, image as xcb_image}; use xcb_util::image as xcb_image;
pub struct Gui { pub struct Gui {
conn: Connection, conn: Connection,
default_screen: i32,
} }
impl Gui { impl Gui {
pub fn new() -> Result<Self> { pub fn new() -> Result<Self> {
let (conn, default_screen) = Connection::connect(None)?; let (conn, _) = Connection::connect(None)?;
Ok(Gui { Ok(Gui { conn })
conn,
default_screen,
})
} }
fn get_default_screen(&self) -> Screen { fn get_default_screen(&self) -> Screen {
@ -58,7 +53,7 @@ impl Gui {
let root_window = screen.root(); let root_window = screen.root();
let (width, height) = (screen.width_in_pixels(), screen.height_in_pixels()); let (width, height) = (screen.width_in_pixels(), screen.height_in_pixels());
let window = xproto::create_window( xproto::create_window(
&self.conn, &self.conn,
xcb::COPY_FROM_PARENT as u8, xcb::COPY_FROM_PARENT as u8,
id, id,

View file

@ -30,7 +30,7 @@ fn main() -> Result<()> {
} }
Region::Selection => { Region::Selection => {
let rectangle = gui.interactive_select(&capture)?; let rectangle = gui.interactive_select(&capture)?;
capture.save_cropped_to(&opt.outfile, rectangle); capture.save_cropped_to(&opt.outfile, rectangle)?;
} }
_ => todo!("TODO"), _ => todo!("TODO"),
} }