Cut down on macro nonsense
- InertAtomic replaced atomic_inert! for improved tooling support - atomic_defaults! is easier to type out than to explain in a docstring - Changed rustfmt config to better support tiny functions such as as_any
This commit is contained in:
@@ -44,9 +44,7 @@ pub enum Loaded {
|
||||
}
|
||||
impl Loaded {
|
||||
/// Is the loaded item source code (not a collection)?
|
||||
pub fn is_code(&self) -> bool {
|
||||
matches!(self, Loaded::Code(_))
|
||||
}
|
||||
pub fn is_code(&self) -> bool { matches!(self, Loaded::Code(_)) }
|
||||
}
|
||||
|
||||
/// Returned by any source loading callback
|
||||
|
||||
@@ -87,8 +87,9 @@ fn load_abs_path_rec(
|
||||
// If the path is not within a file, load it as directory
|
||||
let coll = match get_source(abs_path) {
|
||||
Ok(Loaded::Collection(coll)) => coll,
|
||||
Ok(Loaded::Code(_)) =>
|
||||
unreachable!("split_name returned None but the path is a file"),
|
||||
Ok(Loaded::Code(_)) => {
|
||||
unreachable!("split_name returned None but the path is a file")
|
||||
},
|
||||
Err(e) => {
|
||||
// todo: if this can actually be produced, return Err(ImportAll) instead
|
||||
let parent = abs_path.split_last().expect("import path nonzero").1;
|
||||
|
||||
@@ -14,8 +14,8 @@ use crate::parse::{self, ParsingContext};
|
||||
use crate::representations::sourcefile::{FileEntry, MemberKind};
|
||||
use crate::representations::tree::{ModEntry, ModMember, Module};
|
||||
use crate::sourcefile::{FileEntryKind, Import, Member, ModuleBlock};
|
||||
use crate::utils::pure_push::pushed;
|
||||
use crate::utils::get_or::{get_or_default, get_or_make};
|
||||
use crate::utils::pure_push::pushed;
|
||||
use crate::{Location, Tok, VName};
|
||||
|
||||
struct FileReport {
|
||||
|
||||
@@ -69,8 +69,9 @@ impl Add for PreExtra {
|
||||
fn add(self, rhs: Self) -> Self::Output {
|
||||
match (self, rhs) {
|
||||
(alt, Self::Dir) | (Self::Dir, alt) => Ok(alt),
|
||||
(Self::File(_) | Self::Submod(_), Self::File(_) | Self::Submod(_)) =>
|
||||
panic!("Each file should be parsed once."),
|
||||
(Self::File(_) | Self::Submod(_), Self::File(_) | Self::Submod(_)) => {
|
||||
panic!("Each file should be parsed once.")
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,8 +80,9 @@ impl Display for PreExtra {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Dir => write!(f, "Directory"),
|
||||
Self::File(PreFileExt { name, .. }) =>
|
||||
write!(f, "File({}.orc)", Interner::extern_all(name).join("/")),
|
||||
Self::File(PreFileExt { name, .. }) => {
|
||||
write!(f, "File({}.orc)", Interner::extern_all(name).join("/"))
|
||||
},
|
||||
Self::Submod(_) => write!(f, "Submodule"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user