From 3f8905e6da73f0749a2c2d99ca89bf64aafcf7cd Mon Sep 17 00:00:00 2001 From: itchyny Date: Sun, 19 Nov 2023 22:23:23 +0900 Subject: [PATCH] simplify plugin sample in README.md --- README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3c0c151..06d9360 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ Plugins using this library. ## Example ```rust use mackerel_plugin::*; -use rand; use std::collections::HashMap; struct DicePlugin {} @@ -45,13 +44,9 @@ impl Plugin for DicePlugin { } fn main() { - let plugin = DicePlugin {}; - match plugin.run() { - Ok(_) => {}, - Err(err) => { - eprintln!("mackerel-plugin-dice: {}", err); - std::process::exit(1); - } + if let Err(err) = (DicePlugin {}).run() { + eprintln!("mackerel-plugin-dice: {}", err); + std::process::exit(1); } } ```