Lint fixes introduced with Rust 1.83 (#2646)

* Fixes for lint errors introduced with Rust 1.83

* rustfmt

* Fix more lints.

---------

Co-authored-by: Laurent <laurent.mazare@gmail.com>
This commit is contained in:
Anubhab Bandyopadhyay
2024-11-29 03:30:21 +05:30
committed by GitHub
parent 23ed8a9ded
commit 54e7fc3c97
19 changed files with 57 additions and 55 deletions

View File

@ -21,8 +21,8 @@ fn conv2d_same(
let module = candle_nn::func(move |xs| {
let ih = xs.dim(2)?;
let iw = xs.dim(3)?;
let oh = (ih + s - 1) / s;
let ow = (iw + s - 1) / s;
let oh = ih.div_ceil(s);
let ow = iw.div_ceil(s);
let pad_h = usize::max((oh - 1) * s + k - ih, 0);
let pad_w = usize::max((ow - 1) * s + k - iw, 0);
if pad_h > 0 || pad_w > 0 {

View File

@ -543,7 +543,7 @@ impl<'a> DepthAnythingV2<'a> {
}
}
impl<'a> Module for DepthAnythingV2<'a> {
impl Module for DepthAnythingV2<'_> {
fn forward(&self, xs: &Tensor) -> Result<Tensor> {
let features = self.pretrained.get_intermediate_layers(
xs,

View File

@ -125,8 +125,8 @@ impl Module for Conv2DSame {
let s = self.s;
let k = self.k;
let (_, _, ih, iw) = xs.dims4()?;
let oh = (ih + s - 1) / s;
let ow = (iw + s - 1) / s;
let oh = ih.div_ceil(s);
let ow = iw.div_ceil(s);
let pad_h = usize::max((oh - 1) * s + k - ih, 0);
let pad_w = usize::max((ow - 1) * s + k - iw, 0);
if pad_h > 0 || pad_w > 0 {

View File

@ -89,7 +89,7 @@ impl Config {
fn frame_rate(&self) -> usize {
let hop_length: usize = self.upsampling_ratios.iter().product();
(self.sampling_rate + hop_length - 1) / hop_length
self.sampling_rate.div_ceil(hop_length)
}
fn num_quantizers(&self) -> usize {

View File

@ -23,7 +23,7 @@ pub struct Config {
impl Config {
fn vocab_size(&self) -> usize {
let pad = self.pad_vocab_size_multiple;
(self.vocab_size + pad - 1) / pad * pad
self.vocab_size.div_ceil(pad) * pad
}
fn dt_rank(&self) -> usize {

View File

@ -21,7 +21,7 @@ struct LinearInterpolator<'x, 'y> {
cache: usize,
}
impl<'x, 'y> LinearInterpolator<'x, 'y> {
impl LinearInterpolator<'_, '_> {
fn accel_find(&mut self, x: f64) -> usize {
let xidx = self.cache;
if x < self.xp[xidx] {