Skip to content

Commit 038b5fa

Browse files
committed
bender-slang: Clippy fixes and clean up
1 parent 6477e78 commit 038b5fa

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

crates/bender-slang/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn main() {
2727
];
2828

2929
// Add debug define if in debug build
30-
if build_profile == "debug" && !(target_env == "msvc") {
30+
if build_profile == "debug" && (target_env != "msvc") {
3131
common_cxx_defines.push(("SLANG_DEBUG", "1"));
3232
common_cxx_defines.push(("SLANG_ASSERT_ENABLED", "1"));
3333
};

crates/bender-slang/src/lib.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ impl SyntaxTrees {
203203
}
204204
}
205205

206+
impl Default for SyntaxTrees {
207+
fn default() -> Self {
208+
Self::new()
209+
}
210+
}
211+
206212
impl SlangContext {
207213
/// Creates a new Slang session.
208214
pub fn new() -> Self {
@@ -248,7 +254,8 @@ impl SlangContext {
248254
}
249255
}
250256

251-
/// Creates a new Slang session
252-
pub fn new_session() -> SlangContext {
253-
SlangContext::new()
257+
impl Default for SlangContext {
258+
fn default() -> Self {
259+
Self::new()
260+
}
254261
}

src/cmd/pickle.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::sess::{Session, SessionIo};
1919
use crate::src::{SourceFile, SourceGroup, SourceType};
2020
use crate::target::TargetSet;
2121

22-
use bender_slang::SlangPrintOpts;
22+
use bender_slang::{SlangContext, SlangPrintOpts, SyntaxTrees};
2323

2424
/// Pickle files
2525
#[derive(Args, Debug)]
@@ -179,8 +179,8 @@ pub fn run(sess: &Session, args: PickleArgs) -> Result<()> {
179179
write!(writer, "[")?;
180180
}
181181

182-
let mut parsed_trees = bender_slang::SyntaxTrees::new();
183-
let mut slang = bender_slang::new_session();
182+
let mut parsed_trees = SyntaxTrees::new();
183+
let mut slang = SlangContext::new();
184184
for src_group in srcs {
185185
// Collect include directories and defines from the source group and command line arguments.
186186
let include_dirs: Vec<String> = src_group

0 commit comments

Comments
 (0)