Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: "1.82" # must match Cargo.toml
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -74,6 +79,11 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
Expand All @@ -88,6 +98,12 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ members = [
]
resolver = "2"

[workspace.package]
rust-version = "1.82" # if this changes, edit ci.yaml as well!

[workspace.dependencies]
# `git`-based deps
gimlet-inspector-protocol = { git = "https://github.com/oxidecomputer/gimlet-inspector-protocol" }
Expand Down
28 changes: 0 additions & 28 deletions cmd/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,34 +162,6 @@ impl fmt::Display for TestResult {
}
}

#[derive(Clone, Debug, PartialEq)]
enum TestRunResult {
Pass,
Fail,
Unknown(String),
}

impl From<&str> for TestRunResult {
fn from(input: &str) -> Self {
match input {
"pass" => TestRunResult::Pass,
"FAIL" => TestRunResult::Fail,
_ => TestRunResult::Unknown(input.to_owned()),
}
}
}

#[rustfmt::skip::macros(write)]
impl fmt::Display for TestRunResult {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", match self {
TestRunResult::Pass => "pass".green(),
TestRunResult::Fail => "fail".red(),
TestRunResult::Unknown(ref _str) => "unknown".bold(),
})
}
}

fn test(context: &mut ExecutionContext) -> Result<()> {
let core = &mut **context.core.as_mut().unwrap();
let Subcommand::Other(subargs) = context.cli.cmd.as_ref().unwrap();
Expand Down
1 change: 0 additions & 1 deletion humility-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ name = "humility-bin"
version = "0.12.7"
edition = "2021"
license = "MPL-2.0"
rust-version = "1.68"

[build-dependencies]
cargo_metadata = { workspace = true }
Expand Down
6 changes: 2 additions & 4 deletions humility-bin/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ pub fn subcommand(
CommandKind::Detached { archive, .. } => {
(*archive, HubrisArchiveDoneness::Cook)
}
CommandKind::Raw { .. } => {
(Archive::Required, HubrisArchiveDoneness::Raw)
}
CommandKind::Raw => (Archive::Required, HubrisArchiveDoneness::Raw),
};

if archive != Archive::Ignored {
Expand Down Expand Up @@ -112,6 +110,6 @@ pub fn subcommand(

(run)(context)
}
CommandKind::Raw { .. } => (run)(context),
CommandKind::Raw => (run)(context),
}
}
10 changes: 5 additions & 5 deletions humility-bin/src/cmd_repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,29 @@ impl Prompt {
}

impl reedline::Prompt for Prompt {
fn render_prompt_left(&self) -> Cow<str> {
fn render_prompt_left(&self) -> Cow<'_, str> {
Cow::from(&self.prefix)
}

fn render_prompt_right(&self) -> Cow<str> {
fn render_prompt_right(&self) -> Cow<'_, str> {
self.default_prompt.render_prompt_right()
}

fn render_prompt_indicator(
&self,
prompt_mode: reedline::PromptEditMode,
) -> Cow<str> {
) -> Cow<'_, str> {
self.default_prompt.render_prompt_indicator(prompt_mode)
}

fn render_prompt_multiline_indicator(&self) -> Cow<str> {
fn render_prompt_multiline_indicator(&self) -> Cow<'_, str> {
self.default_prompt.render_prompt_multiline_indicator()
}

fn render_prompt_history_search_indicator(
&self,
history_search: reedline::PromptHistorySearch,
) -> Cow<str> {
) -> Cow<'_, str> {
self.default_prompt
.render_prompt_history_search_indicator(history_search)
}
Expand Down
4 changes: 2 additions & 2 deletions humility-cli/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn validate_single_archive() {
}
"#;

let v: IndexMap<String, Environment> = serde_json::from_str(&data).unwrap();
let v: IndexMap<String, Environment> = serde_json::from_str(data).unwrap();

let _b = v.get("board1").unwrap().archive(&None);
}
Expand All @@ -109,7 +109,7 @@ fn validate_multi_archive() {
}
"#;

let v: IndexMap<String, Environment> = serde_json::from_str(&data).unwrap();
let v: IndexMap<String, Environment> = serde_json::from_str(data).unwrap();

let _b = v.get("board1").unwrap().archive(&Some("name1".to_string()));
let _b = v.get("board1").unwrap().archive(&Some("name2".to_string()));
Expand Down
20 changes: 9 additions & 11 deletions humility-core/src/hubris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ impl Namespaces {
fn to_full_name(
&self,
id: Option<NamespaceId>,
name: &String,
name: &str,
) -> Result<Option<String>> {
let mut n = self.to_full(id)?;

Expand Down Expand Up @@ -790,7 +790,7 @@ impl HubrisArchive {
})
}

pub fn instr_inlined(&self, pc: u32, base: u32) -> Vec<HubrisInlined> {
pub fn instr_inlined(&self, pc: u32, base: u32) -> Vec<HubrisInlined<'_>> {
let mut inlined: Vec<HubrisInlined> = vec![];

//
Expand Down Expand Up @@ -895,7 +895,7 @@ impl HubrisArchive {
.unwrap()
.sensors
.as_ref()
.map_or(true, |s| s.contains(&kind))
.is_none_or(|s| s.contains(&kind))
{
if let Some(rails) = &d.power.as_ref().unwrap().rails {
if idx < rails.len() {
Expand Down Expand Up @@ -1821,7 +1821,7 @@ impl HubrisArchive {
}
}

pub fn lookup_type(&self, goff: HubrisGoff) -> Result<HubrisType> {
pub fn lookup_type(&self, goff: HubrisGoff) -> Result<HubrisType<'_>> {
let r = self
.lookup_struct(goff)
.map(HubrisType::Struct)
Expand Down Expand Up @@ -2840,7 +2840,7 @@ impl HubrisArchive {
task: HubrisTask,
limit: u32,
regs: &BTreeMap<ARMRegister, u32>,
) -> Result<Vec<HubrisStackFrame>> {
) -> Result<Vec<HubrisStackFrame<'_>>> {
let regions = self.regions(core)?;
let sp = regs
.get(&ARMRegister::SP)
Expand Down Expand Up @@ -6427,9 +6427,8 @@ impl HubrisModule {
.map(|g| {
let ns = hubris.structs.get(g).unwrap().namespace;

if let Ok(Some(name)) = hubris
.namespaces
.to_full_name(ns, &name.to_string())
if let Ok(Some(name)) =
hubris.namespaces.to_full_name(ns, name)
{
format!("{name} as {g}")
} else {
Expand Down Expand Up @@ -6474,9 +6473,8 @@ impl HubrisModule {
.map(|g| {
let n = hubris.enums.get(g).unwrap().namespace;

if let Ok(Some(name)) = hubris
.namespaces
.to_full_name(n, &name.to_string())
if let Ok(Some(name)) =
hubris.namespaces.to_full_name(n, name)
{
format!("{name} as {g}")
} else {
Expand Down
4 changes: 2 additions & 2 deletions humility-idol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,11 @@ pub fn lookup_reply<'a>(

/// Extention trait to add `get_idol_command` to a `HubrisArchive`
pub trait HubrisIdol {
fn get_idol_command(&self, name: &str) -> Result<IdolOperation>;
fn get_idol_command(&self, name: &str) -> Result<IdolOperation<'_>>;
}

impl HubrisIdol for HubrisArchive {
fn get_idol_command(&self, name: &str) -> Result<IdolOperation> {
fn get_idol_command(&self, name: &str) -> Result<IdolOperation<'_>> {
let mut iter = name.split('.');
let interface = iter
.next()
Expand Down
3 changes: 0 additions & 3 deletions rust-toolchain.toml

This file was deleted.

Loading