valpackett / evscript

A tiny sandboxed Dyon scripting environment for evdev input devices that lets you do e.g. xcape in Wayland | now on https://codeberg.org/valpackett/evscript
https://codeberg.org/valpackett/evscript
The Unlicense
121 stars 7 forks source link

chore: change 'dyn io::Read' and 'trim_left_matches' deprecated code #11

Closed sandangel closed 4 years ago

sandangel commented 4 years ago

When compiling with rust 1.43, there are some warnings because of deprecated code. This PR only updates simple deprecations. There is try!() deprecation that I don't know how to update yet.

warning: use of deprecated item 'try': use the `?` operator instead
   --> src/main.rs:134:1
    |
134 | dyon_obj!{InputEvent { kind, code, value, device_idx }}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: use of deprecated item 'try': use the `?` operator instead
   --> src/main.rs:136:1
    |
136 | / dyon_fn!{fn device_name(obj: RustObject) -> String {
137 | |     let mut guard = obj.lock().expect(".lock()");
138 | |     let dev = guard.downcast_mut::<Device>().expect(".downcast_mut()");
139 | |     let name = std::str::from_utf8(dev.name().to_bytes()).expect("from_utf8()").to_owned();
140 | |     name
141 | | }}
    | |__^
    |
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: use of deprecated item 'try': use the `?` operator instead
   --> src/main.rs:143:1
    |
143 | / dyon_fn!{fn next_events(arr: Vec<Variable>) -> Vec<InputEvent> {
144 | |     loop {
145 | |         let mut pfds = arr.iter().map(|var| PollFd::new(
146 | |                 with_unwrapped_device!(var, |dev : &mut Device| dev.fd()), EventFlags::POLLIN)).collect::<Vec<_>>();
...   |
158 | |     }
159 | | }}
    | |__^
    |
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: use of deprecated item 'try': use the `?` operator instead
   --> src/main.rs:161:1
    |
161 | / dyon_fn!{fn emit_event(obj: RustObject, evt_v: Variable) -> bool {
162 | |     let mut guard = obj.lock().expect(".lock()");
163 | |     let dev = guard.downcast_mut::<uinput::Device>().expect(".downcast_mut()");
164 | |     if let Variable::Object(evt) = evt_v {
...   |
182 | |     }
183 | | }}
    | |__^
    |
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: use of deprecated item 'try': use the `?` operator instead
   --> src/main.rs:161:1
    |
161 | / dyon_fn!{fn emit_event(obj: RustObject, evt_v: Variable) -> bool {
162 | |     let mut guard = obj.lock().expect(".lock()");
163 | |     let dev = guard.downcast_mut::<uinput::Device>().expect(".downcast_mut()");
164 | |     if let Variable::Object(evt) = evt_v {
...   |
182 | |     }
183 | | }}
    | |__^
    |
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

    Finished release [optimized] target(s) in 0.15s
valpackett commented 4 years ago

There is try!() deprecation

Well they're coming from dyon's macros, so not our fault.