Skip to content

Commit

Permalink
Clippy and format
Browse files Browse the repository at this point in the history
  • Loading branch information
dburgener committed Sep 28, 2023
1 parent 00d27ec commit a29728f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub fn extend_type_map(
let mut new_type = new_type.inner(&mut warnings);
new_type
.associated_resources
.append(&mut (associated_resources).into());
.append(&mut associated_resources);
type_map.insert(t.name.to_string(), new_type)?;
}
Err(e) => errors.append(e),
Expand Down Expand Up @@ -1537,7 +1537,7 @@ pub fn get_synthetic_resource_name(
// resource was defined
match associated_resource.get_range() {
Some(range) => CascadeString::new(cs_name, range),
None => CascadeString::from(cs_name)
None => CascadeString::from(cs_name),
}
}

Expand Down Expand Up @@ -1574,7 +1574,7 @@ fn create_synthetic_resource(
if types.get(res_name.as_ref()).is_some() {
// A synthetic type with this name already exists, due to a nested association
return Err(
match make_duplicate_associate_error(types, dom_info, &class_string) {
match make_duplicate_associate_error(types, dom_info, class_string) {
Some(e) => e.into(),
None => ErrorItem::Internal(InternalError::new()),
},
Expand Down
16 changes: 9 additions & 7 deletions src/internal_rep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,9 @@ impl TypeInfo {
use crate::compile::get_synthetic_resource_name;

for ann in &self.annotations {
if let AnnotationInfo::Associate(associations) | AnnotationInfo::NestAssociate(associations) = ann {
if let AnnotationInfo::Associate(associations)
| AnnotationInfo::NestAssociate(associations) = ann
{
for res in &associations.resources {
if res.string_is_instance(&CascadeString::from(associate_name))
&& res.get_range(associate_name).is_some()
Expand All @@ -631,13 +633,13 @@ impl TypeInfo {
}
}
}
let ar_range = self.associated_resources
let ar_range = self
.associated_resources
.iter()
.find(|a| a.string_is_instance(&associate_name.into()))
.and_then(|ar| {
ar.get_range(
get_synthetic_resource_name(&self.name, &associate_name.into())
.as_ref(),
get_synthetic_resource_name(&self.name, &associate_name.into()).as_ref(),
)
});

Expand All @@ -655,9 +657,9 @@ impl TypeInfo {
None
}
}
None => {
self.explicitly_associates(get_synthetic_resource_name(&self.name, &associate_name.into()).as_ref())
}
None => self.explicitly_associates(
get_synthetic_resource_name(&self.name, &associate_name.into()).as_ref(),
),
}
}

Expand Down

0 comments on commit a29728f

Please sign in to comment.