Skip to content

Commit 107316b

Browse files
committed
Copilot suggestions
1 parent 165a1a0 commit 107316b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

humility-core/src/hubris.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ impl HubrisI2cBusList {
515515
pub fn lookup_i2c_bus(&self, bus: &str) -> Result<&HubrisI2cBus> {
516516
self.0
517517
.iter()
518-
.find(|&b| b.name == Some(bus.to_string()))
518+
.find(|&b| b.name.as_deref() == Some(bus))
519519
.ok_or_else(|| anyhow!("couldn't find bus {}", bus))
520520
}
521521

@@ -1369,7 +1369,7 @@ impl HubrisArchive {
13691369

13701370
// Load the main manifest config file
13711371
let app = hubris.extract_file("app.toml")?;
1372-
let mut config: HubrisConfig = toml::from_slice(app.as_bytes())?;
1372+
let mut config: HubrisConfig = toml::from_slice(&app)?;
13731373

13741374
// Apply TOML patches, if `patches.toml` is present in the archive.
13751375
if let Ok(patches) = hubris.extract_file("patches.toml") {
@@ -1440,6 +1440,8 @@ impl HubrisArchive {
14401440
let mut objects = (0..hubris.file_count()?)
14411441
.into_par_iter()
14421442
.map(|i| -> Result<Option<(usize, String, Vec<u8>)>> {
1443+
// TODO(matt) once hubtools#65 is merged, this can be made more
1444+
// efficient; right now, it extracts every file.
14431445
let (name, data) = hubris.extract_file_by_index(i)?;
14441446
let path = Path::new(&name);
14451447
let pieces = path.iter().collect::<Vec<_>>();

0 commit comments

Comments
 (0)