Skip to content

Commit c6e51b6

Browse files
committed
chore: fix clippy & win addrinfo
1 parent a5782c9 commit c6e51b6

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

immix

pl_linker/src/linker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl Linker for MsvcLinker {
327327
"-libpath:{}",
328328
p.to_str()
329329
.unwrap()
330-
.trim_end_matches(|c| c == '\\')
330+
.trim_end_matches('\\')
331331
.replace('\\', r"\\")
332332
));
333333
});

src/ast/node/function.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ impl FuncCallNode {
153153
}
154154
let v = para
155155
.emit(ctx, builder)
156-
.map(|re| {
156+
.inspect(|_| {
157157
ctx.expect_ty = None;
158-
re
159158
})?
160159
.get_value();
161160
if v.is_none() {

src/utils/read_config.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,8 @@ pub fn prepare_build_envs(db: &dyn Db, kagari_source: SourceProgram) -> Result<C
312312
pb.set_message(format!("正在分析依赖{}", k));
313313
if PathBuf::from(&v.path).is_absolute() {
314314
_ = crate::utils::canonicalize(&v.path)
315-
.map(|p| {
315+
.inspect(|p| {
316316
v.path = p.to_str().unwrap().to_string();
317-
p
318317
})
319318
.map_err(|e| {
320319
pb.abandon_with_message(format!("error: {:?}", e));
@@ -323,9 +322,8 @@ pub fn prepare_build_envs(db: &dyn Db, kagari_source: SourceProgram) -> Result<C
323322
});
324323
} else {
325324
_ = crate::utils::canonicalize(config_root.join(&v.path))
326-
.map(|p| {
325+
.inspect(|p| {
327326
v.path = p.to_str().unwrap().to_string();
328-
p
329327
})
330328
.map_err(|e| {
331329
pb.abandon_with_message(format!("error: {:?}", e));

vm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ bytecount = "0.6.3"
1616
context = "3.0.0"
1717
thread-priority = "1.2.0"
1818
[target.'cfg(windows)'.dependencies]
19-
winapi = { version = "0.3", features = ["winuser", "wincrypt"] }
19+
winapi = { version = "0.3", features = ["winuser", "wincrypt", "ws2def"] }
2020

2121
[dev-dependencies]
2222
rand = "0.8"

vm/src/libcwrap/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,19 @@ impl LibC {
6969
.unwrap()
7070
}
7171
}
72+
73+
#[cfg(not(target_os = "windows"))]
7274
fn addrinfo_ai_addr(ai: *const libc::addrinfo) -> *const libc::sockaddr {
7375
unsafe { (*ai).ai_addr }
7476
}
77+
78+
#[cfg(target_os = "windows")]
79+
fn addrinfo_ai_addr(
80+
ai: *const winapi::shared::ws2def::ADDRINFOA,
81+
) -> *const winapi::shared::ws2def::SOCKADDR {
82+
unsafe { (*ai).ai_addr }
83+
}
84+
7585
fn open(path: *const u8, byte_len: i64, flags: libc::c_int) -> libc::c_int {
7686
// create cstr from ptr and len
7787
let path = unsafe { std::slice::from_raw_parts(path, byte_len as usize) };

0 commit comments

Comments
 (0)