Skip to content

Commit e17da1a

Browse files
committed
Fix Clippy
1 parent 4454305 commit e17da1a

11 files changed

Lines changed: 18 additions & 19 deletions

File tree

crates/hyperqueue/src/client/commands/submit/directives.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::common::utils::fs::read_at_most;
1919

2020
const MAX_PREFIX_OF_SUBMIT_SCRIPT: usize = 32 * 1024; // 32KiB
2121

22-
fn p_double_quoted(input: &str) -> NomResult<&str> {
22+
fn p_double_quoted(input: &str) -> NomResult<'_, &str> {
2323
preceded(
2424
char('"'),
2525
cut(terminated(
@@ -29,7 +29,7 @@ fn p_double_quoted(input: &str) -> NomResult<&str> {
2929
)(input)
3030
}
3131

32-
fn p_arg(input: &str) -> NomResult<String> {
32+
fn p_arg(input: &str) -> NomResult<'_, String> {
3333
alt((
3434
map(p_double_quoted, |s| s.to_string()),
3535
map(

crates/hyperqueue/src/client/output/cli.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use cli_table::format::{Justify, Separator};
22
use cli_table::{Cell, CellStruct, Color, ColorChoice, Style, Table, TableStruct, print_stdout};
3-
use itertools::Itertools;
43

54
use std::fmt::{Display, Write};
65

crates/hyperqueue/src/common/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ where
215215
map_parse_result(all_consuming(f)(input).map(|r| r.1), input)
216216
}
217217

218-
fn p_integer_string(input: &str) -> NomResult<String> {
218+
fn p_integer_string(input: &str) -> NomResult<'_, String> {
219219
let parser = tuple((
220220
satisfy(|c| c.is_dec_digit()),
221221
many0(satisfy(|c| c.is_dec_digit() || c == '_')),
@@ -228,14 +228,14 @@ fn p_integer_string(input: &str) -> NomResult<String> {
228228
}
229229

230230
/// Parse 4 byte integer.
231-
pub fn p_u32(input: &str) -> NomResult<u32> {
231+
pub fn p_u32(input: &str) -> NomResult<'_, u32> {
232232
map_res(p_integer_string, |number| number.parse())
233233
.context(CONTEXT_INTEGER)
234234
.parse(input)
235235
}
236236

237237
/// Parse 8 byte integer
238-
pub fn p_u64(input: &str) -> NomResult<u64> {
238+
pub fn p_u64(input: &str) -> NomResult<'_, u64> {
239239
map_res(p_integer_string, |number| number.parse())
240240
.context(CONTEXT_INTEGER)
241241
.parse(input)

crates/hyperqueue/src/common/placeholders.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ pub enum StringPart<'a> {
190190
Placeholder(&'a str),
191191
}
192192

193-
fn parse_placeholder(data: &str) -> NomResult<&str> {
193+
fn parse_placeholder(data: &str) -> NomResult<'_, &str> {
194194
delimited(tag("%{"), take_until("}"), tag("}"))(data)
195195
}
196196

@@ -216,7 +216,7 @@ pub fn has_placeholders(data: &str) -> bool {
216216
/// StringPart::Verbatim("c"),
217217
/// ]);
218218
/// ```
219-
pub fn parse_resolvable_string(data: &str) -> Vec<StringPart> {
219+
pub fn parse_resolvable_string(data: &str) -> Vec<StringPart<'_>> {
220220
let mut parts = vec![];
221221
let mut input = data;
222222
let mut start = 0;

crates/hyperqueue/src/common/utils/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22

33
/// Return the input string with an added "s" at the end if `count` is larger than one and non-zero.
4-
pub fn pluralize(value: &str, count: usize) -> Cow<str> {
4+
pub fn pluralize(value: &str, count: usize) -> Cow<'_, str> {
55
if count == 1 {
66
Cow::Borrowed(value)
77
} else {
@@ -21,7 +21,7 @@ pub fn select_plural<'a>(single: &'a str, other: &'a str, count: usize) -> Cow<'
2121
/// Truncates the middle of a string so that it's total length doesn't exceed `length`.
2222
/// The returned string will never exceed `length`.
2323
/// `length` has to be at least five, otherwise there wouldn't be space for `...`.
24-
pub fn truncate_middle(value: &str, length: usize) -> Cow<str> {
24+
pub fn truncate_middle(value: &str, length: usize) -> Cow<'_, str> {
2525
assert!(length >= 5);
2626

2727
if value.len() <= length {

crates/hyperqueue/src/dashboard/ui/styles.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn table_block_with_title(title: Line) -> Block {
3535
.title(title)
3636
}
3737

38-
pub fn style_column_headers(cells: Vec<&str>) -> Row {
38+
pub fn style_column_headers(cells: Vec<&str>) -> Row<'_> {
3939
Row::new(cells).style(
4040
Style::default()
4141
.fg(Color::Yellow)

crates/hyperqueue/src/stream/reader/outputlog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl OutputLog {
211211
Ok(index)
212212
}
213213

214-
fn check_header(file: &mut BufReader<File>) -> anyhow::Result<StreamFileHeader> {
214+
fn check_header(file: &mut BufReader<File>) -> anyhow::Result<StreamFileHeader<'_>> {
215215
let mut header = [0u8; STREAM_FILE_HEADER.len()];
216216
file.read_exact(&mut header)?;
217217
if header != STREAM_FILE_HEADER {

crates/hyperqueue/src/worker/hwdetect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ fn read_linux_thread_siblings(cpu_id: &ResourceLabel) -> anyhow::Result<Vec<Reso
248248
.map(|indices| indices.into_iter().map(|i| i.to_string()).collect())
249249
}
250250

251-
fn p_cpu_range(input: &str) -> NomResult<Vec<ResourceIndex>> {
251+
fn p_cpu_range(input: &str) -> NomResult<'_, Vec<ResourceIndex>> {
252252
map_res(
253253
tuple((
254254
terminated(p_u32, space0),
@@ -262,7 +262,7 @@ fn p_cpu_range(input: &str) -> NomResult<Vec<ResourceIndex>> {
262262
.parse(input)
263263
}
264264

265-
fn p_cpu_ranges(input: &str) -> NomResult<Vec<ResourceIndex>> {
265+
fn p_cpu_ranges(input: &str) -> NomResult<'_, Vec<ResourceIndex>> {
266266
separated_list1(terminated(tag(","), space0), p_cpu_range)(input)
267267
.map(|(a, b)| (a, b.into_iter().flatten().collect()))
268268
}

crates/pyhq/src/client/job.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ use pyo3::exceptions::PyException;
2020
use pyo3::prelude::PyAnyMethods;
2121
use pyo3::types::PyTuple;
2222
use pyo3::{Bound, IntoPyObject, PyAny, PyResult, Python};
23-
use std::collections::{BTreeMap, BTreeSet, HashMap};
23+
use std::collections::{BTreeSet, HashMap};
2424
use std::path::{Path, PathBuf};
2525
use std::time::Duration;
26+
use tako::JobTaskCount;
2627
use tako::gateway::{
2728
CrashLimit, ResourceRequestEntries, ResourceRequestEntry, ResourceRequestVariants,
2829
TaskDataFlags,
2930
};
3031
use tako::program::{FileOnCloseBehavior, ProgramDefinition, StdioDef};
3132
use tako::resources::{AllocationRequest, NumOfNodes, ResourceAmount};
32-
use tako::{JobTaskCount, Set};
3333

3434
#[derive(Debug, FromPyObject)]
3535
enum AllocationValue {

crates/tako/src/internal/common/wrapped.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ impl<T: ?Sized> WrappedRcRefCell<T> {
4444
/// Return a immutable reference to contents. Panics whenever `RefCell::borrow()` would.
4545
#[inline]
4646
#[track_caller]
47-
pub fn get(&self) -> Ref<T> {
47+
pub fn get(&self) -> Ref<'_, T> {
4848
self.inner.deref().borrow()
4949
}
5050

5151
/// Return a mutable reference to contents. Panics whenever `RefCell::borrow_mut()` would.
5252
#[inline]
5353
#[track_caller]
54-
pub fn get_mut(&self) -> RefMut<T> {
54+
pub fn get_mut(&self) -> RefMut<'_, T> {
5555
self.inner.deref().borrow_mut()
5656
}
5757

0 commit comments

Comments
 (0)