clippy
This commit is contained in:
parent
f3da22fc5c
commit
f385215d6e
|
@ -60,14 +60,14 @@ type FileMap = std::collections::HashMap<String, File, ahash::RandomState>;
|
|||
|
||||
fn stringify_files(files: &FileMap) -> Result<String, std::fmt::Error> {
|
||||
let mut buf = String::new();
|
||||
write!(buf, "const FILES: [BuildFile; {}] = [\n", files.len())?;
|
||||
writeln!(buf, "const FILES: [BuildFile; {}] = [", files.len())?;
|
||||
for (bare_path, file) in files {
|
||||
let include_path = &file.include_path;
|
||||
let etag = file.etag.to_hex();
|
||||
let encoding = file.encoding.to_str();
|
||||
write!(buf, " BuildFile {{ bare_path: {bare_path:?}, data: include_bytes!({include_path:?}), etag: {etag:?}, encoding: {encoding} }},\n")?;
|
||||
writeln!(buf, " BuildFile {{ bare_path: {bare_path:?}, data: include_bytes!({include_path:?}), etag: {etag:?}, encoding: {encoding} }},")?;
|
||||
}
|
||||
write!(buf, "];\n")?;
|
||||
writeln!(buf, "];")?;
|
||||
Ok(buf)
|
||||
}
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ fn compare_stream(
|
|||
stream
|
||||
.recordings
|
||||
.entry(id.recording())
|
||||
.or_insert_with(Recording::default)
|
||||
.or_default()
|
||||
.recording_row = Some(s);
|
||||
}
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ fn compare_stream(
|
|||
stream
|
||||
.recordings
|
||||
.entry(id.recording())
|
||||
.or_insert_with(Recording::default)
|
||||
.or_default()
|
||||
.playback_row = Some(s);
|
||||
}
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ fn compare_stream(
|
|||
stream
|
||||
.recordings
|
||||
.entry(id.recording())
|
||||
.or_insert_with(Recording::default)
|
||||
.or_default()
|
||||
.integrity_row = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ impl Value for SignalValue {
|
|||
type Change = SignalChange;
|
||||
|
||||
fn apply(&mut self, c: &SignalChange) {
|
||||
if self.states.len() < usize::try_from(c.new_state).unwrap() {
|
||||
if self.states.len() < usize::from(c.new_state) {
|
||||
self.states.resize(c.new_state as usize, 0);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ impl Value for SignalValue {
|
|||
|
||||
if c.old_state > 0 {
|
||||
// remove from old state.
|
||||
let i = usize::try_from(c.old_state).unwrap() - 1;
|
||||
let i = usize::from(c.old_state) - 1;
|
||||
assert!(
|
||||
self.states.len() > i,
|
||||
"no such old state: s={self:?} c={c:?}"
|
||||
|
|
|
@ -183,7 +183,7 @@ fn get_preopened_sockets() -> Result<FastHashMap<String, Listener>, Error> {
|
|||
fn read_config(path: &Path) -> Result<ConfigFile, Error> {
|
||||
let config = std::fs::read(path)?;
|
||||
let config = std::str::from_utf8(&config).map_err(|e| err!(InvalidArgument, source(e)))?;
|
||||
let config = toml::from_str(&config).map_err(|e| err!(InvalidArgument, source(e)))?;
|
||||
let config = toml::from_str(config).map_err(|e| err!(InvalidArgument, source(e)))?;
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ where
|
|||
// (from the preceding slice) the start of its range.
|
||||
let (i, slice_start) = match self.slices.binary_search_by_key(&range.start, |s| s.end()) {
|
||||
Ok(i) => (i + 1, self.slices[i].end()), // desired start == slice i's end; first is i+1!
|
||||
Err(i) if i == 0 => (0, 0), // desired start < slice 0's end; first is 0.
|
||||
Err(0) => (0, 0), // desired start < slice 0's end; first is 0.
|
||||
Err(i) => (i, self.slices[i - 1].end()), // desired start < slice i's end; first is i.
|
||||
};
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ impl Ui {
|
|||
);
|
||||
hdrs.insert(header::CONTENT_TYPE, HeaderValue::from_static(content_type));
|
||||
let e = node.into_file_entity(hdrs).err_kind(ErrorKind::Internal)?;
|
||||
Ok(http_serve::serve(e, &req))
|
||||
Ok(http_serve::serve(e, req))
|
||||
}
|
||||
#[cfg(feature = "bundled-ui")]
|
||||
Ui::Bundled(ui) => {
|
||||
|
|
Loading…
Reference in New Issue