Skip to content

Commit 085268a

Browse files
committed
Remove unnecessary pub on tmp variables
1 parent c869c22 commit 085268a

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎cpp2rust/converter/converter.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Converter::MaterializeTemp(const std::string &binding_name,
237237
auto pointee = param_type.getNonReferenceType();
238238
auto value = ConvertRValue(expr, pointee);
239239
auto type_str = ToStringBase(pointee);
240-
const char *decl = in_const_initializer_ ? "pub static" : keyword::kLet;
240+
const auto *decl = in_const_initializer_ ? keyword::kStatic : keyword::kLet;
241241

242242
auto binding =
243243
std::format("{} mut {} : {} = {};", decl, binding_name, type_str, value);

‎cpp2rust/converter/models/converter_refcount.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ ConverterRefCount::MaterializeTemp(const std::string &binding_name,
368368
auto pointee = param_type.getNonReferenceType();
369369
auto value = ConvertRValue(expr, pointee);
370370
auto type_str = ToStringBase(pointee);
371-
const char *decl = in_const_initializer_ ? "pub static" : keyword::kLet;
371+
const auto *decl = in_const_initializer_ ? keyword::kStatic : keyword::kLet;
372372

373373
auto binding = std::format("{} {} : Value<{}> = Rc::new(RefCell::new({}));",
374374
decl, binding_name, type_str, value);

‎tests/unit/out/refcount/rvalue_ref_global.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write};
77
use std::os::fd::AsFd;
88
use std::rc::{Rc, Weak};
99
thread_local!(
10-
pub static __tmp_0: Value<i32> = Rc::new(RefCell::new(5));
10+
static __tmp_0: Value<i32> = Rc::new(RefCell::new(5));
1111
pub static g_0: Ptr<i32> = __tmp_0.with(Value::as_pointer);
1212
);
1313
pub fn main() {

‎tests/unit/out/unsafe/rvalue_ref_global.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::collections::BTreeMap;
66
use std::io::{Read, Seek, Write};
77
use std::os::fd::{AsFd, FromRawFd, IntoRawFd};
88
use std::rc::Rc;
9-
pub static mut __tmp_0: i32 = 5;
9+
static mut __tmp_0: i32 = 5;
1010
pub static mut g_0: *mut i32 = unsafe { &mut __tmp_0 };
1111
pub fn main() {
1212
unsafe {

0 commit comments

Comments
 (0)