clippy
cargo devel CI / cargo CI (push) Has been cancelled
Details
cargo devel CI / cargo CI (push) Has been cancelled
Details
This commit is contained in:
parent
17da4f55f4
commit
d47ac72cdc
|
@ -291,7 +291,6 @@ fn main() {
|
||||||
} {
|
} {
|
||||||
Some(inner) => {
|
Some(inner) => {
|
||||||
println!("{:?}", inner);
|
println!("{:?}", inner);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
None => unreachable!(),
|
None => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Through
|
||||||
use revsqrt::{fast_inverse_sqrt, regular_inverse_sqrt};
|
use revsqrt::{fast_inverse_sqrt, regular_inverse_sqrt};
|
||||||
|
|
||||||
const SIZE: f32 = 1337.1337;
|
const SIZE: f32 = 1337.1337;
|
||||||
const FCONST: f32 = 1024.12481224;
|
const FCONST: f32 = 1_024.124_8;
|
||||||
const FCONST1: f32 = 4025.724812234;
|
const FCONST1: f32 = 4_025.724_9;
|
||||||
|
|
||||||
pub fn single_input(c: &mut Criterion) {
|
pub fn single_input(c: &mut Criterion) {
|
||||||
c.bench_with_input(BenchmarkId::new("regular rsqrt", SIZE), &SIZE, |b, &s| {
|
c.bench_with_input(BenchmarkId::new("regular rsqrt", SIZE), &SIZE, |b, &s| {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use std::iter::zip;
|
use std::iter::zip;
|
||||||
|
|
||||||
use revsqrt;
|
|
||||||
|
|
||||||
use rand;
|
|
||||||
|
|
||||||
|
|
||||||
// is n about the same as m?
|
// is n about the same as m?
|
||||||
// This is actually not so easy! How do you measure "about same"ness?
|
// This is actually not so easy! How do you measure "about same"ness?
|
||||||
|
@ -34,14 +34,14 @@ fn test_calc_regular_rsqrt() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_calc_specific_fast_rsqrt() {
|
fn test_calc_specific_fast_rsqrt() {
|
||||||
let params: &[f32] = &[1.0, 1.1, 100.0, 1337.0, 123.45678900, 1337.1337];
|
let params: &[f32] = &[1.0, 1.1, 100.0, 1337.0, 123.456_79, 1337.1337];
|
||||||
let results: &[f32] = &[
|
let results: &[f32] = &[
|
||||||
1.0,
|
1.0,
|
||||||
0.9534625892455922,
|
0.953_462_6,
|
||||||
0.1,
|
0.1,
|
||||||
0.02734854943722097,
|
0.027_348_55,
|
||||||
0.0900000004095,
|
0.09,
|
||||||
0.027347182112297627,
|
0.027_347_183,
|
||||||
];
|
];
|
||||||
for (n, m) in zip(params, results) {
|
for (n, m) in zip(params, results) {
|
||||||
assert!(about_same(revsqrt::fast_inverse_sqrt(*n), *m))
|
assert!(about_same(revsqrt::fast_inverse_sqrt(*n), *m))
|
||||||
|
@ -50,14 +50,14 @@ fn test_calc_specific_fast_rsqrt() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_calc_specific_reqular_rsqrt() {
|
fn test_calc_specific_reqular_rsqrt() {
|
||||||
let params: &[f32] = &[1.0, 1.1, 100.0, 1337.0, 123.45678900, 1337.1337];
|
let params: &[f32] = &[1.0, 1.1, 100.0, 1337.0, 123.456_79, 1337.1337];
|
||||||
let results: &[f32] = &[
|
let results: &[f32] = &[
|
||||||
1.0,
|
1.0,
|
||||||
0.9534625892455922,
|
0.953_462_6,
|
||||||
0.1,
|
0.1,
|
||||||
0.02734854943722097,
|
0.027_348_55,
|
||||||
0.0900000004095,
|
0.09,
|
||||||
0.027347182112297627,
|
0.027_347_183,
|
||||||
];
|
];
|
||||||
for (n, m) in zip(params, results) {
|
for (n, m) in zip(params, results) {
|
||||||
assert_eq!(revsqrt::regular_inverse_sqrt(*n), *m)
|
assert_eq!(revsqrt::regular_inverse_sqrt(*n), *m)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use std::iter::zip;
|
use std::iter::zip;
|
||||||
|
|
||||||
use revsqrt;
|
|
||||||
|
|
||||||
use cucumber::{gherkin::Step, given, then, when, World};
|
use cucumber::{gherkin::Step, given, then, when, World};
|
||||||
use rand;
|
|
||||||
|
|
||||||
/// stores the current information for each scenario
|
/// stores the current information for each scenario
|
||||||
#[derive(Debug, Default, World)]
|
#[derive(Debug, Default, World)]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use anyhow;
|
|
||||||
use chrono;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json;
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||||
#[serde(rename_all = "UPPERCASE")]
|
#[serde(rename_all = "UPPERCASE")]
|
||||||
|
|
|
@ -6,16 +6,18 @@ use std::{
|
||||||
|
|
||||||
// This is just a very simple tcp server/client that connects to itself
|
// This is just a very simple tcp server/client that connects to itself
|
||||||
|
|
||||||
const ADDR: &'static str = "127.0.0.1:9911";
|
const ADDR: & str = "127.0.0.1:9911";
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let mut listen = net::TcpListener::bind(ADDR)?;
|
let listen = net::TcpListener::bind(ADDR)?;
|
||||||
let mut client = net::TcpStream::connect(ADDR)?;
|
let mut client = net::TcpStream::connect(ADDR)?;
|
||||||
let mut sink = io::sink();
|
let _sink = io::sink();
|
||||||
client.write_all(b"foo")?;
|
client.write_all(b"foo")?;
|
||||||
let mut com = listen.accept()?;
|
let mut com = listen.accept()?;
|
||||||
com.0.write_all(b"bak")?;
|
com.0.write_all(b"bak")?;
|
||||||
let mut buf = [0;3];
|
let mut buf = [0; 3];
|
||||||
|
#[allow(clippy::unused_io_amount)]
|
||||||
|
#[allow(clippy::all)]
|
||||||
client.read(&mut buf)?;
|
client.read(&mut buf)?;
|
||||||
println!("{buf:x?}");
|
println!("{buf:x?}");
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -41,8 +41,8 @@ impl ThreadPool {
|
||||||
///
|
///
|
||||||
/// The `new` function will panic if the size is zero.
|
/// The `new` function will panic if the size is zero.
|
||||||
pub fn build(size: usize) -> Result<ThreadPool, String> {
|
pub fn build(size: usize) -> Result<ThreadPool, String> {
|
||||||
if !(size > 0) {
|
if size <= 0 {
|
||||||
return Err(format!("cannot build a thread pool with size 0!"));
|
return Err("cannot build a thread pool with size 0!".to_string());
|
||||||
}
|
}
|
||||||
let (sender, receiver) = mpsc::channel();
|
let (sender, receiver) = mpsc::channel();
|
||||||
let receiver = Arc::new(Mutex::new(receiver));
|
let receiver = Arc::new(Mutex::new(receiver));
|
||||||
|
|
|
@ -12,7 +12,7 @@ async fn foo(t: TestType) -> Result<TcpListener, std::io::Error> {
|
||||||
#[tokio::main()]
|
#[tokio::main()]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let testdata: TestType = 1337;
|
let testdata: TestType = 1337;
|
||||||
let arcmut = Arc::new(Mutex::new(testdata));
|
let _arcmut = Arc::new(Mutex::new(testdata));
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let a = foo(testdata).await;
|
let a = foo(testdata).await;
|
||||||
a.unwrap().accept().await
|
a.unwrap().accept().await
|
||||||
|
|
Loading…
Reference in New Issue