tests/inst: cargo fmt

This commit is contained in:
Colin Walters 2021-03-17 18:45:07 +00:00
parent 92e2bc397b
commit c52a2ff52e
2 changed files with 12 additions and 13 deletions

View File

@ -108,21 +108,22 @@ impl RebootMark {
strategy: &InterruptStrategy, strategy: &InterruptStrategy,
) -> &mut BTreeMap<UpdateResult, u32> { ) -> &mut BTreeMap<UpdateResult, u32> {
match strategy { match strategy {
InterruptStrategy::Polite(t) => self InterruptStrategy::Polite(t) => {
.polite self.polite.entry(t.clone()).or_insert_with(BTreeMap::new)
.entry(t.clone()) }
.or_insert_with(BTreeMap::new), InterruptStrategy::Force(t) => {
InterruptStrategy::Force(t) => self self.force.entry(t.clone()).or_insert_with(BTreeMap::new)
.force }
.entry(t.clone())
.or_insert_with(BTreeMap::new),
} }
} }
} }
impl InterruptStrategy { impl InterruptStrategy {
pub(crate) fn is_noop(&self) -> bool { pub(crate) fn is_noop(&self) -> bool {
matches!(self, InterruptStrategy::Polite(PoliteInterruptStrategy::None)) matches!(
self,
InterruptStrategy::Polite(PoliteInterruptStrategy::None)
)
} }
} }
@ -598,9 +599,7 @@ fn transactionality() -> Result<()> {
upgrade_and_finalize().context("Firstrun upgrade failed")?; upgrade_and_finalize().context("Firstrun upgrade failed")?;
let end = time::Instant::now(); let end = time::Instant::now();
let cycle_time = end.duration_since(start); let cycle_time = end.duration_since(start);
let tdata = TransactionalTestInfo { let tdata = TransactionalTestInfo { cycle_time };
cycle_time,
};
let mut f = std::io::BufWriter::new(std::fs::File::create(&TDATAPATH)?); let mut f = std::io::BufWriter::new(std::fs::File::create(&TDATAPATH)?);
serde_json::to_writer(&mut f, &tdata)?; serde_json::to_writer(&mut f, &tdata)?;
f.flush()?; f.flush()?;

View File

@ -82,7 +82,7 @@ pub(crate) const TEST_HTTP_BASIC_AUTH: &str = "foouser:barpw";
fn validate_authz(value: &[u8]) -> Result<bool> { fn validate_authz(value: &[u8]) -> Result<bool> {
let buf = std::str::from_utf8(&value)?; let buf = std::str::from_utf8(&value)?;
if let Some(o) = buf.find("Basic ") { if let Some(o) = buf.find("Basic ") {
let (_, buf) = buf.split_at(o + "Basic ".len()); let (_, buf) = buf.split_at(o + "Basic ".len());
let buf = base64::decode(buf).context("decoding")?; let buf = base64::decode(buf).context("decoding")?;
let buf = std::str::from_utf8(&buf)?; let buf = std::str::from_utf8(&buf)?;
Ok(buf == TEST_HTTP_BASIC_AUTH) Ok(buf == TEST_HTTP_BASIC_AUTH)