Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some clippy warnings #583

Merged
merged 2 commits into from
Sep 26, 2024
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
6 changes: 3 additions & 3 deletions numbat/src/ffi/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ pub fn show(args: Args) -> Result<Value> {
// Dynamic dispatch hack since we don't have bounded polymorphism.
// And no real support for generics in the FFI.
let Value::StructInstance(info, _) = args.front().unwrap() else {
return Err(RuntimeError::UserError(format!(
"Unsupported argument to 'show'.",
)));
return Err(RuntimeError::UserError(
"Unsupported argument to 'show'.".into(),
));
};

let plot = if info.name == "LinePlot" {
Expand Down
2 changes: 1 addition & 1 deletion numbat/src/typechecker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@ impl TypeChecker {
.collect(),
typed_parameters
.iter()
.map(|(span, name, _, ref type_annotation)| {
.map(|(span, name, _, type_annotation)| {
(
*span,
name.clone(),
Expand Down
10 changes: 5 additions & 5 deletions numbat/src/typed_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ impl DTypeFactor {
}
}

type DtypeFactorPower = (DTypeFactor, Exponent);

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct DType {
// Always in canonical form
pub factors: Vec<(DTypeFactor, Exponent)>, // TODO make this private
pub factors: Vec<DtypeFactorPower>, // TODO make this private
}

impl DType {
pub fn from_factors(factors: &[(DTypeFactor, Exponent)]) -> DType {
pub fn from_factors(factors: &[DtypeFactorPower]) -> DType {
let mut dtype = DType {
factors: factors.into(),
};
Expand Down Expand Up @@ -201,9 +203,7 @@ impl DType {
.contains(name)
}

pub fn split_first_factor(
&self,
) -> Option<(&(DTypeFactor, Exponent), &[(DTypeFactor, Exponent)])> {
pub fn split_first_factor(&self) -> Option<(&DtypeFactorPower, &[DtypeFactorPower])> {
self.factors.split_first()
}

Expand Down
Loading