Skip to content

Commit

Permalink
Clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Mar 21, 2023
1 parent e1957a9 commit c74ae9b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ fn remove_existed_type_def(type_def_file: &str) -> std::io::Result<()> {
.open(type_def_file)?;

content.write_all(cleaned_content.as_bytes())?;
content.write(b"\n")?;
content.write_all(b"\n")?;
}
Ok(())
}
3 changes: 3 additions & 0 deletions examples/napi/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export class ExternalObject<T> {
[K: symbol]: T
}
}
export interface Shared {
value: number
}
/** This is a const */
export const DEFAULT_COST: number
export function getWords(): Array<string>
Expand Down
4 changes: 2 additions & 2 deletions examples/napi/src/threadsafe_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ pub async fn tsfn_return_promise_timeout(func: ThreadsafeFunction<u32>) -> Resul
let sleep = time::sleep(Duration::from_nanos(1));
tokio::select! {
_ = sleep => {
return Err(Error::new(Status::GenericFailure, "Timeout".to_owned()));
Err(Error::new(Status::GenericFailure, "Timeout".to_owned()))
}
value = promise => {
return Ok(value? + 2);
Ok(value? + 2)
}
}
}

1 comment on commit c74ae9b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: c74ae9b Previous: 3b831f4 Ratio
noop#napi-rs 52358119 ops/sec (±0.93%) 49256299 ops/sec (±1.23%) 0.94
noop#JavaScript 578863541 ops/sec (±0.81%) 729666474 ops/sec (±0.95%) 1.26
Plus number#napi-rs 14968335 ops/sec (±1.05%) 14677733 ops/sec (±0.96%) 0.98
Plus number#JavaScript 599104383 ops/sec (±0.44%) 696004559 ops/sec (±1.06%) 1.16
Create buffer#napi-rs 356411 ops/sec (±9.94%) 316631 ops/sec (±9.79%) 0.89
Create buffer#JavaScript 1684013 ops/sec (±8.84%) 1472552 ops/sec (±6.88%) 0.87
createArray#createArrayJson 34171 ops/sec (±0.37%) 32700 ops/sec (±0.99%) 0.96
createArray#create array for loop 6383 ops/sec (±0.36%) 6001 ops/sec (±0.88%) 0.94
createArray#create array with serde trait 6373 ops/sec (±0.35%) 6151 ops/sec (±0.77%) 0.97
getArrayFromJs#get array from json string 14160 ops/sec (±0.3%) 14300 ops/sec (±0.95%) 1.01
getArrayFromJs#get array from serde 8628 ops/sec (±0.3%) 8369 ops/sec (±1.05%) 0.97
getArrayFromJs#get array with for loop 10656 ops/sec (±0.36%) 10193 ops/sec (±1.25%) 0.96
Get Set property#Get Set from native#u32 384722 ops/sec (±8.75%) 387711 ops/sec (±8.4%) 1.01
Get Set property#Get Set from JavaScript#u32 337305 ops/sec (±9.67%) 341191 ops/sec (±9.69%) 1.01
Get Set property#Get Set from native#string 374221 ops/sec (±3.42%) 371833 ops/sec (±4.07%) 0.99
Get Set property#Get Set from JavaScript#string 310768 ops/sec (±17.45%) 310627 ops/sec (±14.99%) 1.00
Async task#spawn task 25706 ops/sec (±7.1%) 27194 ops/sec (±3.62%) 1.06
Async task#ThreadSafeFunction 1749 ops/sec (±5.49%) 1493 ops/sec (±3.3%) 0.85
Async task#Tokio future to Promise 24053 ops/sec (±2.34%) 27053 ops/sec (±2%) 1.12
Query#query * 100 1628 ops/sec (±1.69%) 1546 ops/sec (±2.17%) 0.95
Query#query * 1 24056 ops/sec (±2.11%) 21866 ops/sec (±2.53%) 0.91

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.