Skip to content

Commit 29c2ee3

Browse files
committed
Cargo fmt
1 parent cfd0a7f commit 29c2ee3

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

examples/return-string-from-managed/main.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
use core::slice;
44
use std::{
5-
ffi::{CStr, CString}, mem::{self, MaybeUninit}, os::raw::c_char, str::Utf8Error, string::FromUtf16Error,
5+
ffi::{CStr, CString},
6+
mem::{self, MaybeUninit},
7+
os::raw::c_char,
8+
str::Utf8Error,
9+
string::FromUtf16Error,
610
};
711

812
use netcorehost::{
@@ -66,7 +70,10 @@ fn print_string_from_csharp_using_unmanaged_alloc(delegate_loader: &AssemblyDele
6670
pdcstr!("FreeUnmanagedMemory"),
6771
)
6872
.unwrap();
69-
FREE_H_GLOBAL.set(free_h_global).ok().expect("string interop already init");
73+
FREE_H_GLOBAL
74+
.set(free_h_global)
75+
.ok()
76+
.expect("string interop already init");
7077

7178
// actual usage
7279
let get_name = delegate_loader
@@ -109,7 +116,7 @@ impl HGlobalString {
109116

110117
impl Drop for HGlobalString {
111118
fn drop(&mut self) {
112-
FREE_H_GLOBAL.get().expect("string interop not init")(self.ptr);
119+
FREE_H_GLOBAL.get().expect("string interop not init")(self.ptr);
113120
}
114121
}
115122

@@ -122,7 +129,10 @@ fn print_string_from_csharp_using_gc_handle(delegate_loader: &AssemblyDelegateLo
122129
pdcstr!("FreeGCHandleString"),
123130
)
124131
.unwrap();
125-
FREE_GC_HANDLE_STRING.set(free_gc_handle_string).ok().expect("string interop already init");
132+
FREE_GC_HANDLE_STRING
133+
.set(free_gc_handle_string)
134+
.ok()
135+
.expect("string interop already init");
126136

127137
let get_string_data_offset = delegate_loader
128138
.get_function_with_unmanaged_callers_only::<fn() -> usize>(
@@ -131,7 +141,9 @@ fn print_string_from_csharp_using_gc_handle(delegate_loader: &AssemblyDelegateLo
131141
)
132142
.unwrap();
133143
let string_data_offset = get_string_data_offset();
134-
STRING_DATA_OFFSET.set(string_data_offset).expect("string interop already init");
144+
STRING_DATA_OFFSET
145+
.set(string_data_offset)
146+
.expect("string interop already init");
135147

136148
// actual usage
137149
let get_name = delegate_loader
@@ -181,7 +193,9 @@ impl GcHandleString {
181193

182194
impl Drop for GcHandleString {
183195
fn drop(&mut self) {
184-
FREE_GC_HANDLE_STRING.get().expect("string interop not init")(self.0);
196+
FREE_GC_HANDLE_STRING
197+
.get()
198+
.expect("string interop not init")(self.0);
185199
}
186200
}
187201

src/hostfxr/library3_0.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,11 @@ impl Hostfxr {
177177
) -> Result<HostfxrContext<InitializedForCommandLine>, HostingError> {
178178
let parameters = hostfxr_initialize_parameters::with_host_path(host_path.as_ref().as_ptr());
179179
unsafe {
180-
self.initialize_for_dotnet_command_line_with_parameters(app_path, args, &raw const parameters)
180+
self.initialize_for_dotnet_command_line_with_parameters(
181+
app_path,
182+
args,
183+
&raw const parameters,
184+
)
181185
}
182186
}
183187

@@ -216,7 +220,11 @@ impl Hostfxr {
216220
let parameters =
217221
hostfxr_initialize_parameters::with_dotnet_root(dotnet_root.as_ref().as_ptr());
218222
unsafe {
219-
self.initialize_for_dotnet_command_line_with_parameters(app_path, args, &raw const parameters)
223+
self.initialize_for_dotnet_command_line_with_parameters(
224+
app_path,
225+
args,
226+
&raw const parameters,
227+
)
220228
}
221229
}
222230

@@ -314,7 +322,10 @@ impl Hostfxr {
314322
) -> Result<HostfxrContext<InitializedForRuntimeConfig>, HostingError> {
315323
let parameters = hostfxr_initialize_parameters::with_host_path(host_path.as_ref().as_ptr());
316324
unsafe {
317-
self.initialize_for_runtime_config_with_parameters(runtime_config_path, &raw const parameters)
325+
self.initialize_for_runtime_config_with_parameters(
326+
runtime_config_path,
327+
&raw const parameters,
328+
)
318329
}
319330
}
320331
/// This function loads the specified `.runtimeconfig.json`, resolve all frameworks, resolve all the assets from those frameworks and
@@ -349,7 +360,10 @@ impl Hostfxr {
349360
let parameters =
350361
hostfxr_initialize_parameters::with_dotnet_root(dotnet_root.as_ref().as_ptr());
351362
unsafe {
352-
self.initialize_for_runtime_config_with_parameters(runtime_config_path, &raw const parameters)
363+
self.initialize_for_runtime_config_with_parameters(
364+
runtime_config_path,
365+
&raw const parameters,
366+
)
353367
}
354368
}
355369

0 commit comments

Comments
 (0)