Skip to content

Commit

Permalink
Merge branch 'master' into esdrubal/associated_types_fully_qualified_…
Browse files Browse the repository at this point in the history
…types
  • Loading branch information
IGI-111 authored Oct 13, 2023
2 parents 024d525 + 53fd58d commit 4313cad
Show file tree
Hide file tree
Showing 20 changed files with 102 additions and 345 deletions.
3 changes: 1 addition & 2 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
[The Sway Programming Language](./index.md)

- [Introduction](./introduction/index.md)
- [Installation](./introduction/installation.md)
- [Sway Quickstart](./introduction/sway_quickstart.md)
- [Getting Started](./introduction/getting_started.md)
- [The Fuel Toolchain](./introduction/fuel_toolchain.md)
- [A Forc Project](./introduction/forc_project.md)
- [Standard Library](./introduction/standard_library.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/introduction/fuel_toolchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Sway Language Server `forc-lsp` is provided to expose features to IDEs. [Ins

## Sway Formatter (`forc-fmt`)

A canonical formatter is provided with `forc-fmt`. [Installation instructions](./installation.md). It can be run manually with
A canonical formatter is provided with `forc-fmt`. [Installation instructions](./getting_started.md). It can be run manually with

```sh
forc fmt
Expand Down
9 changes: 9 additions & 0 deletions docs/book/src/introduction/getting_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Getting Started

## Installing the `Fuel` toolchain

Please visit the Fuel [Installation Guide](https://docs.fuel.network/guides/installation) to install the Fuel toolchain binaries and prerequisites.

## Sway Quickstart

Check out the [Developer Quickstart Guide](https://docs.fuel.network/guides/quickstart/) for a step-by-step guide on building a fullstack dapp on Fuel. The guide will walk you through writing a smart contract, setting up a wallet, and building a frontend to interact with your contract.
3 changes: 1 addition & 2 deletions docs/book/src/introduction/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

To get started with Forc and Sway smart contract development, install the Fuel toolchain and Fuel full node and set up your first project.

- [Installation](./installation.md)
- [Sway Quickstart](./sway_quickstart.md)
- [Getting Started](./getting_started.md)
- [The Fuel Toolchain](./fuel_toolchain.md)
- [A Forc Project](./forc_project.md)
- [Standard Library](./standard_library.md)
170 changes: 0 additions & 170 deletions docs/book/src/introduction/installation.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/book/src/introduction/sway_quickstart.md

This file was deleted.

12 changes: 12 additions & 0 deletions swayfmt/src/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ impl CommentsContext {
}
}

#[inline]
pub fn has_comments_in_formatter(formatter: &Formatter, range: &Range<usize>) -> bool {
formatter
.comments_context
.map
.comments_between(range)
.peekable()
.peek()
.is_some()
}

#[inline]
pub fn has_comments<I: Iterator>(comments: I) -> bool {
comments.peekable().peek().is_some()
}
Expand Down
6 changes: 1 addition & 5 deletions swayfmt/src/config/imports.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Configuration options related to formatting imports.
use crate::config::{lists::ListTactic, user_opts::ImportsOptions, whitespace::IndentStyle};
use crate::config::{user_opts::ImportsOptions, whitespace::IndentStyle};
use serde::{Deserialize, Serialize};

#[derive(Debug, Copy, Clone)]
Expand All @@ -10,8 +10,6 @@ pub struct Imports {
pub imports_granularity: ImportGranularity,
/// Indent of imports.
pub imports_indent: IndentStyle,
/// Item layout inside a import block.
pub imports_layout: ListTactic,
}

impl Default for Imports {
Expand All @@ -20,7 +18,6 @@ impl Default for Imports {
group_imports: GroupImports::Preserve,
imports_granularity: ImportGranularity::Preserve,
imports_indent: IndentStyle::Block,
imports_layout: ListTactic::Mixed,
}
}
}
Expand All @@ -34,7 +31,6 @@ impl Imports {
.imports_granularity
.unwrap_or(default.imports_granularity),
imports_indent: opts.imports_indent.unwrap_or(default.imports_indent),
imports_layout: opts.imports_layout.unwrap_or(default.imports_layout),
}
}
}
Expand Down
13 changes: 1 addition & 12 deletions swayfmt/src/config/items.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Configuration options related to item formatting.
use crate::{
config::{lists::ListTactic, user_opts::ItemsOptions},
config::user_opts::ItemsOptions,
constants::{DEFAULT_BLANK_LINES_LOWER_BOUND, DEFAULT_BLANK_LINES_UPPER_BOUND},
};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -57,17 +57,6 @@ pub enum ItemsLayout {
Vertical,
}

impl ItemsLayout {
pub fn to_list_tactic(self, len: usize) -> ListTactic {
match self {
ItemsLayout::Compressed => ListTactic::Mixed,
ItemsLayout::Tall => ListTactic::HorizontalVertical,
ItemsLayout::Vertical if len == 1 => ListTactic::Horizontal,
ItemsLayout::Vertical => ListTactic::Vertical,
}
}
}

/// Where to put the opening brace of items (`fn`, `impl`, etc.).
#[derive(Serialize, Deserialize, Debug, Copy, Clone)]
pub enum ItemBraceStyle {
Expand Down
Loading

0 comments on commit 4313cad

Please sign in to comment.