Make sure Notification cannot outlive Context

This commit is contained in:
Mika Attila
2015-03-07 14:21:17 +01:00
parent 2d06fb7cc3
commit 68b3d02ba2
2 changed files with 9 additions and 9 deletions

View File

@@ -1,9 +1,7 @@
extern crate libnotify;
fn main() {
let n = {
let notify = libnotify::Context::new("hello").unwrap();
notify.new_notification("Hello, ", "World!").unwrap()
};
let notify = libnotify::Context::new("hello").unwrap();
let n = notify.new_notification("Hello, ", "World!").unwrap();
n.show().unwrap();
}