Skip to content

Commit f0ea189

Browse files
committed
windows
1 parent fd5d459 commit f0ea189

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

scylla-rust-wrapper/src/cass_error.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,12 @@ impl ToCassError for DbError {
133133
DbError::ConfigError => CassError::CASS_ERROR_SERVER_CONFIG_ERROR,
134134
DbError::AlreadyExists { .. } => CassError::CASS_ERROR_SERVER_ALREADY_EXISTS,
135135
DbError::Unprepared { .. } => CassError::CASS_ERROR_SERVER_UNPREPARED,
136-
DbError::Other(num) =>
137-
{
138-
#[allow(
139-
clippy::unnecessary_cast,
140-
reason = "C enum backing type on MSVC is i32)"
141-
)]
142-
CassError(
143-
((CassErrorSource::CASS_ERROR_SOURCE_SERVER.0 as u32) << 24) | *num as u32,
144-
)
136+
DbError::Other(num) => {
137+
// On windows enums are i32, so we need to cast it
138+
#[allow(clippy::unnecessary_cast)]
139+
let source = CassErrorSource::CASS_ERROR_SOURCE_SERVER.0 as u32;
140+
let code = (source << 24) | (*num as u32);
141+
CassError(code as _)
145142
}
146143
// TODO: add appropriate error if rate limit reached
147144
DbError::RateLimitReached { .. } => CassError::CASS_ERROR_SERVER_UNAVAILABLE,

0 commit comments

Comments
 (0)