Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenByteDev committed Aug 13, 2023
1 parent 7c227d5 commit 96e137a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/hostfxr/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ impl<I> HostfxrContext<I> {
r#type,
delegate.as_mut_ptr(),
)
}.unwrap();
}
.unwrap();

HostingResult::from(result).into_result()?;

Expand Down
4 changes: 3 additions & 1 deletion src/hostfxr/library.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::{
dlopen2::wrapper::Container, error::{HostingResult, HostingError}, nethost::LoadHostfxrError,
dlopen2::wrapper::Container,
error::{HostingError, HostingResult},
nethost::LoadHostfxrError,
pdcstring::PdCString,
};
use derive_more::From;
Expand Down
3 changes: 2 additions & 1 deletion src/hostfxr/library1_0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ impl Hostfxr {
let result = unsafe {
self.lib
.hostfxr_main(args.len().try_into().unwrap(), args.as_ptr())
}.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);
}
.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);

AppOrHostingResult::from(result)
}
Expand Down
6 changes: 4 additions & 2 deletions src/hostfxr/library2_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ impl Hostfxr {
dotnet_root.as_ptr(),
app_path.as_ptr(),
)
}.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);
}
.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);

Ok(AppOrHostingResult::from(result))
}
Expand Down Expand Up @@ -93,7 +94,8 @@ impl Hostfxr {
flags,
resolve_sdk2_callback,
)
}.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);
}
.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);
HostingResult::from(result).into_result()?;

let sdk_path = RESOLVE_SDK2_DATA
Expand Down
6 changes: 4 additions & 2 deletions src/hostfxr/library3_0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ impl Hostfxr {
parameters,
hostfxr_handle.as_mut_ptr(),
)
}.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);
}
.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);

let success_code = HostingResult::from(result).into_result()?;

Expand Down Expand Up @@ -365,7 +366,8 @@ impl Hostfxr {
parameters,
hostfxr_handle.as_mut_ptr(),
)
}.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);
}
.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);

let success_code = HostingResult::from(result).into_result()?;

Expand Down
3 changes: 2 additions & 1 deletion src/hostfxr/library6_0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ impl Hostfxr {
get_dotnet_environment_info_callback,
info.as_mut_ptr().cast(),
)
}.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);
}
.unwrap_or(UNSUPPORTED_HOST_VERSION_ERROR_CODE);
HostingResult::from(result).into_result()?;
let info = unsafe { MaybeUninit::assume_init(info) };
Ok(info)
Expand Down
15 changes: 10 additions & 5 deletions src/hostfxr/runtime_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ impl<I> HostfxrContext<I> {
name.as_ref().as_ptr(),
value.as_mut_ptr(),
)
}.unwrap();
}
.unwrap();
HostingResult::from(result).into_result()?;

Ok(unsafe { PdCStr::from_str_ptr(value.assume_init()) })
Expand All @@ -39,7 +40,8 @@ impl<I> HostfxrContext<I> {
name.as_ref().as_ptr(),
value.as_ref().as_ptr(),
)
}.unwrap();
}
.unwrap();
HostingResult::from(result).into_result().map(|_| ())
}

Expand All @@ -54,7 +56,8 @@ impl<I> HostfxrContext<I> {
name.as_ref().as_ptr(),
ptr::null(),
)
}.unwrap();
}
.unwrap();
HostingResult::from(result).into_result().map(|_| ())
}

Expand All @@ -69,7 +72,8 @@ impl<I> HostfxrContext<I> {
ptr::null_mut(),
ptr::null_mut(),
)
}.unwrap();
}
.unwrap();

// ignore buffer too small error as the first call is only to get the required buffer size.
match HostingResult::from(result).into_result() {
Expand All @@ -88,7 +92,8 @@ impl<I> HostfxrContext<I> {
keys.as_mut_ptr(),
values.as_mut_ptr(),
)
}.unwrap();
}
.unwrap();
HostingResult::from(result).into_result()?;

unsafe { keys.set_len(count) };
Expand Down

0 comments on commit 96e137a

Please sign in to comment.