Skip to content

Commit 1d366a1

Browse files
committed
Fix minimum required version check
1 parent 75ab763 commit 1d366a1

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

src/callbacks.rs

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ use std::{
77
thread,
88
};
99

10-
use ffi;
11-
use libc;
1210
use static_assertions::assert_obj_safe;
1311

1412
use crate::{edit, utils::FdWriter, Data, Error, Result};

src/edit.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,18 @@ ffi_enum_wrapper! {
114114

115115
impl StatusCode {
116116
pub fn needs_response(&self) -> bool {
117-
match self {
117+
matches!(
118+
self,
118119
Self::AlreadySigned
119-
| Self::Error
120-
| Self::GetBool
121-
| Self::GetLine
122-
| Self::KeyCreated
123-
| Self::NeedPassphraseSym
124-
| Self::ScOpFailure
125-
| Self::CardCtrl
126-
| Self::BackupKeyCreated => true,
127-
_ => false,
128-
}
120+
| Self::Error
121+
| Self::GetBool
122+
| Self::GetLine
123+
| Self::KeyCreated
124+
| Self::NeedPassphraseSym
125+
| Self::ScOpFailure
126+
| Self::CardCtrl
127+
| Self::BackupKeyCreated
128+
)
129129
}
130130

131131
pub fn into_result(self) -> Result<()> {

src/lib.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,17 @@ pub fn set_flag(name: impl CStrArgument, val: impl CStrArgument) -> Result<()> {
143143
}
144144

145145
cfg_if::cfg_if! {
146-
if #[cfg(feature = "v1_18")] {
146+
if #[cfg(feature = "v1_23")] {
147+
const MIN_VERSION: &[u8] = b"1.23.0\0";
148+
} else if #[cfg(feature = "v1_22")] {
149+
const MIN_VERSION: &[u8] = b"1.22.0\0";
150+
} else if #[cfg(feature = "v1_21")] {
151+
const MIN_VERSION: &[u8] = b"1.21.0\0";
152+
} else if #[cfg(feature = "v1_20")] {
153+
const MIN_VERSION: &[u8] = b"1.20.0\0";
154+
} else if #[cfg(feature = "v1_19")] {
155+
const MIN_VERSION: &[u8] = b"1.19.0\0";
156+
} else if #[cfg(feature = "v1_18")] {
147157
const MIN_VERSION: &[u8] = b"1.18.0\0";
148158
} else if #[cfg(feature = "v1_17")] {
149159
const MIN_VERSION: &[u8] = b"1.17.0\0";

src/utils.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use std::io::{self, prelude::*};
22

3-
use ffi;
4-
use libc;
5-
63
use crate::Error;
74

85
pub use cstr_argument::CStrArgument;

0 commit comments

Comments
 (0)