fix: weird extra space above definitions

This commit is contained in:
rvcas 2022-11-05 15:42:53 -04:00
parent 4cad053e15
commit 14724f924c
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
6 changed files with 4 additions and 24 deletions

View File

@ -119,7 +119,7 @@ impl<'comments> Formatter<'comments> {
end != 0 end != 0
} }
fn definitions<'a>(&mut self, definitions: &'a [UntypedDefinition]) -> Vec<Document<'a>> { fn definitions<'a>(&mut self, definitions: &'a [UntypedDefinition]) -> Document<'a> {
let mut has_imports = false; let mut has_imports = false;
let mut has_declarations = false; let mut has_declarations = false;
let mut imports = Vec::new(); let mut imports = Vec::new();
@ -161,11 +161,11 @@ impl<'comments> Formatter<'comments> {
nil() nil()
}; };
vec![imports, sep, declarations] docvec![imports, sep, declarations]
} }
fn module<'a>(&mut self, module: &'a UntypedModule) -> Document<'a> { fn module<'a>(&mut self, module: &'a UntypedModule) -> Document<'a> {
let groups = join(self.definitions(&module.definitions), lines(2)); let groups = self.definitions(&module.definitions);
// Now that `groups` has been collected, only freestanding comments (//) // Now that `groups` has been collected, only freestanding comments (//)
// and doc comments (///) remain. Freestanding comments aren't associated // and doc comments (///) remain. Freestanding comments aren't associated

View File

@ -1,5 +1 @@
pub type ScriptContext { thing: String } pub type ScriptContext { thing: String }

View File

@ -1,7 +1,3 @@
pub type ScriptContext(purpose) { tx_info: TxInfo, script_purpose: purpose } pub type ScriptContext(purpose) { tx_info: TxInfo, script_purpose: purpose }
pub type TxInfo { idk: Int } pub type TxInfo { idk: Int }

View File

@ -1,10 +1,6 @@
use sample/context use sample/context
pub type Mint { currency_symbol: ByteArray, thing: Int, thing: Int, thing: Int }
pub type Mint { currency_symbol: ByteArray }
pub type ScriptContext = pub type ScriptContext =
context.ScriptContext(Mint) context.ScriptContext(Mint)

View File

@ -1,9 +1,5 @@
use sample/context use sample/context
pub type Spend { idk: Int } pub type Spend { idk: Int }
pub type ScriptContext = pub type ScriptContext =

View File

@ -1,10 +1,6 @@
use sample/mint use sample/mint
use sample/spend use sample/spend
pub type Datum { something: String } pub type Datum { something: String }
pub type Redeemer { pub type Redeemer {