Compare commits

..

2 Commits

Author SHA1 Message Date
4cddc8571f panic/foramt lint
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-13 18:44:16 -07:00
ea30bc9ed4 Remove direnv setup, use parent. 2021-06-13 18:39:05 -07:00
7 changed files with 10 additions and 45 deletions

1
.envrc
View File

@ -1 +0,0 @@
use_nix

View File

@ -1,34 +0,0 @@
let
unstableTarball = fetchTarball
"https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
pkgs = import <nixpkgs> { };
unstable = import unstableTarball { };
in with pkgs;
pkgs.mkShell rec {
name = "rust";
buildInputs = [
entr
openssl
pkg-config
unstable.cargo
unstable.rustc
unstable.rustfmt
unstable.rust-analyzer
postgresql
diesel-cli
];
# By default setup dev environment.
AWS_ACCESS_KEY_ID = "0BO8BCZZXV3SFZ1B43W1";
AWS_SECRET_ACCESS_KEY = "x6SjXJZuP1tMzxH/a6xEFDcMw4XB8qCfRPNbuGzN";
DATABASE_USER = "comics_devel";
DATABASE_NAME = "comics_devel";
DATABASE_HOST = "postgres.h.xinu.tv";
DATABASE_URL =
"postgres://${DATABASE_USER}@${DATABASE_HOST}/${DATABASE_NAME}";
PROD_DATABASE_USER = "comics";
PROD_DATABASE_NAME = "comics";
PROD_DATABASE_HOST = "postgres.h.xinu.tv";
PROD_DATABASE_URL =
"postgres://${PROD_DATABASE_USER}@${PROD_DATABASE_HOST}/${PROD_DATABASE_NAME}";
}

View File

@ -78,10 +78,10 @@ fn box_z_compare(ah: &Box<dyn Hit>, bh: &Box<dyn Hit>) -> std::cmp::Ordering {
// returns a reference.)
fn vec_first_into<T>(v: Vec<T>) -> T {
if v.len() != 1 {
panic!(format!(
panic!(
"vec_first_into called for vector length != 1, length {}",
v.len()
));
);
}
v.into_iter().next().unwrap()
}

View File

@ -22,10 +22,10 @@ pub enum KDTree {
// returns a reference.)
fn vec_first_into<T>(v: Vec<T>) -> T {
if v.len() != 1 {
panic!(format!(
panic!(
"vec_first_into called for vector length != 1, length {}",
v.len()
));
);
}
v.into_iter().next().unwrap()
}

View File

@ -27,16 +27,16 @@ impl Texture for ImageTexture {
let x = (u % 1. * (self.width - 1.)) as u32;
let y = ((1. - v % 1.) * (self.height - 1.)) as u32;
if x >= self.width as u32 {
panic!(format!(
panic!(
"u {} v {} x {} y {} w {} h {}",
u, v, x, y, self.width, self.height
));
);
}
if y >= self.height as u32 {
panic!(format!(
panic!(
"u {} v {} x {} y {} w {} h {}",
u, v, x, y, self.width, self.height
));
);
}
let pixel = self.img.get_pixel(x, y);
Vec3::new(

View File

@ -27,7 +27,7 @@ fn hsv_to_rgb(h: f32, s: f32, v: f32) -> Vec3 {
3 => Vec3::new(p, q, v),
4 => Vec3::new(t, p, v),
5 => Vec3::new(v, p, q),
_ => panic!(format!("Unknown H value {}", h_i)),
_ => panic!("Unknown H value {}", h_i),
}
}

View File

@ -144,7 +144,7 @@ impl Index<usize> for Vec3 {
0 => &self.x,
1 => &self.y,
2 => &self.z,
_ => panic!(format!("idx {} out of range for vec3", idx)),
_ => panic!("idx {} out of range for vec3", idx),
}
}
}