diff options
author | Judy Hsiao <judyhsiao@google.com> | 2020-03-16 15:58:03 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-17 03:02:42 +0000 |
commit | 5934305f37a765f8c611d9a24d9d5f012845d39b (patch) | |
tree | a4a39d1c815033b57e64879bb3d9816b1b787347 /seccomp | |
parent | 8476d79a3c0976355695dde780786179c3417667 (diff) | |
download | crosvm-5934305f37a765f8c611d9a24d9d5f012845d39b.tar crosvm-5934305f37a765f8c611d9a24d9d5f012845d39b.tar.gz crosvm-5934305f37a765f8c611d9a24d9d5f012845d39b.tar.bz2 crosvm-5934305f37a765f8c611d9a24d9d5f012845d39b.tar.lz crosvm-5934305f37a765f8c611d9a24d9d5f012845d39b.tar.xz crosvm-5934305f37a765f8c611d9a24d9d5f012845d39b.tar.zst crosvm-5934305f37a765f8c611d9a24d9d5f012845d39b.zip |
crosvm: Change expected field to String in InvalidValue
Change the type of argument::Error::InvalidValue::expected from "&'static str" to String. It allows the lower level parse error object to handle the output of the expected value so that the rule of parsing will not be duplicated. For example, instead of: ``` v.parse::<Settings>() .map_err(|e| argument::Error::InvalidValue { value: v.to_string(), expected: "The value of setting should null or cras", })?; ``` we can have: ``` v.parse::<Settings>() .map_err(|e| argument::Error::InvalidValue { value: v.to_string(), expected: e.to_string(), })?; ``` and the expected value can be handled in the Display implementaion of Settings::ParseError. BUG=b:140866281 TEST=cargo build Change-Id: Ieba12a21103945fe0e47c70a190a4e5d985af537 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2103605 Tested-by: Judy Hsiao <judyhsiao@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Auto-Submit: Judy Hsiao <judyhsiao@chromium.org> Commit-Queue: Judy Hsiao <judyhsiao@chromium.org>
Diffstat (limited to 'seccomp')
0 files changed, 0 insertions, 0 deletions