Skip to content

Commit a99583f

Browse files
committed
chore: fix build
1 parent 605d12d commit a99583f

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

packages/cubejs-backend-native/src/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl SqlAuthService for NodeBridgeAuthService {
142142
context: Arc::new(NativeSQLAuthContext {
143143
user,
144144
superuser: response.superuser,
145-
security_context: response.security_context,
145+
security_context: NonDebugInRelease::from(response.security_context),
146146
}),
147147
password: response.password,
148148
skip_password_check: response.skip_password_check.unwrap_or(false),

packages/cubejs-backend-native/src/node_export.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::sql4sql::sql4sql;
1818
use crate::stream::OnDrainHandler;
1919
use crate::tokio_runtime_node;
2020
use crate::transport::NodeBridgeTransport;
21-
use crate::utils::batch_to_rows;
21+
use crate::utils::{batch_to_rows, NonDebugInRelease};
2222
use cubenativeutils::wrappers::neon::context::neon_run_with_guarded_lifetime;
2323
use cubenativeutils::wrappers::neon::inner_types::NeonInnerTypes;
2424
use cubenativeutils::wrappers::neon::object::NeonObject;
@@ -429,7 +429,7 @@ fn exec_sql(mut cx: FunctionContext) -> JsResult<JsValue> {
429429
let native_auth_ctx = Arc::new(NativeSQLAuthContext {
430430
user: Some(String::from("unknown")),
431431
superuser: false,
432-
security_context,
432+
security_context: NonDebugInRelease::from(security_context),
433433
});
434434

435435
let (deferred, promise) = cx.promise();

packages/cubejs-backend-native/src/sql4sql.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::auth::NativeSQLAuthContext;
1616
use crate::config::NodeCubeServices;
1717
use crate::cubesql_utils::with_session;
1818
use crate::tokio_runtime_node;
19+
use crate::utils::NonDebugInRelease;
1920

2021
enum Sql4SqlQueryType {
2122
Regular,
@@ -208,7 +209,7 @@ pub fn sql4sql(mut cx: FunctionContext) -> JsResult<JsValue> {
208209
let native_auth_ctx = Arc::new(NativeSQLAuthContext {
209210
user: Some(String::from("unknown")),
210211
superuser: false,
211-
security_context,
212+
security_context: NonDebugInRelease::from(security_context),
212213
});
213214

214215
let (deferred, promise) = cx.promise();

packages/cubejs-backend-native/src/utils.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,37 +42,35 @@ pub fn batch_to_rows(batch: RecordBatch) -> Result<(Value, Vec<Value>), CubeErro
4242
}
4343

4444
/// Allow skipping Debug output in release builds for specific field or type.
45-
pub struct NonDebugInRelease<T: Debug> {
46-
inner: T,
47-
}
45+
pub struct NonDebugInRelease<T: Debug>(T);
4846

4947
impl<T: Debug> Debug for NonDebugInRelease<T> {
5048
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5149
if cfg!(debug_assertions) {
5250
f.debug_struct("skipped in release build").finish()
5351
} else {
54-
self.inner.fmt(f)
52+
self.0.fmt(f)
5553
}
5654
}
5755
}
5856

5957
impl<T: Debug> From<T> for NonDebugInRelease<T> {
6058
fn from(value: T) -> Self {
61-
Self { inner: value }
59+
Self(value)
6260
}
6361
}
6462

6563
impl<T: Debug> Deref for NonDebugInRelease<T> {
6664
type Target = T;
6765

6866
fn deref(&self) -> &Self::Target {
69-
&self.inner
67+
&self.0
7068
}
7169
}
7270

7371
impl<T: Debug> DerefMut for NonDebugInRelease<T> {
7472
fn deref_mut(&mut self) -> &mut Self::Target {
75-
&mut self.inner
73+
&mut self.0
7674
}
7775
}
7876

@@ -81,8 +79,6 @@ where
8179
T: Default,
8280
{
8381
fn default() -> Self {
84-
Self {
85-
inner: T::default(),
86-
}
82+
Self(T::default())
8783
}
8884
}

0 commit comments

Comments
 (0)