Skip to content

Commit 46917c2

Browse files
committed
fmt and clippy updated
1 parent a0b9970 commit 46917c2

34 files changed

Lines changed: 2209 additions & 1174 deletions

File tree

.github/workflows/ci.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: 1
12+
13+
jobs:
14+
check:
15+
name: Check
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: dtolnay/rust-toolchain@stable
20+
- uses: Swatinem/rust-cache@v2
21+
- run: cargo check --all-targets
22+
23+
fmt:
24+
name: Format
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: dtolnay/rust-toolchain@stable
29+
with:
30+
components: rustfmt
31+
- run: cargo fmt --all -- --check
32+
33+
clippy:
34+
name: Clippy
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: dtolnay/rust-toolchain@stable
39+
with:
40+
components: clippy
41+
- uses: Swatinem/rust-cache@v2
42+
- run: cargo clippy --all-targets -- -D warnings
43+
44+
test:
45+
name: Test (${{ matrix.os }})
46+
runs-on: ${{ matrix.os }}
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
os: [ubuntu-latest, macos-latest, windows-latest]
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: dtolnay/rust-toolchain@stable
54+
- uses: Swatinem/rust-cache@v2
55+
- run: cargo test --all
56+
57+
build:
58+
name: Build
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
- uses: dtolnay/rust-toolchain@stable
63+
- uses: Swatinem/rust-cache@v2
64+
- run: cargo build --release
65+
66+
docs:
67+
name: Docs
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v4
71+
- uses: dtolnay/rust-toolchain@stable
72+
- uses: Swatinem/rust-cache@v2
73+
- run: cargo doc --no-deps --all
74+
env:
75+
RUSTDOCFLAGS: -D warnings
76+
77+
msrv:
78+
name: MSRV (1.75)
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: actions/checkout@v4
82+
- uses: dtolnay/rust-toolchain@1.75
83+
- uses: Swatinem/rust-cache@v2
84+
- run: cargo check --all

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# SolScript
22

3+
[![CI](https://github.com/cryptuon/solscript/actions/workflows/ci.yml/badge.svg)](https://github.com/cryptuon/solscript/actions/workflows/ci.yml)
4+
[![Crates.io](https://img.shields.io/crates/v/solscript-cli.svg)](https://crates.io/crates/solscript-cli)
5+
[![Documentation](https://docs.rs/solscript-cli/badge.svg)](https://docs.rs/solscript-cli)
6+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7+
[![Rust Version](https://img.shields.io/badge/rust-1.75%2B-blue.svg)](https://www.rust-lang.org)
8+
39
**Write Solidity. Deploy to Solana.**
410

511
SolScript lets you write smart contracts in familiar Solidity syntax and compile them to native Solana programs. No Rust required. No Anchor boilerplate. Just your contract logic.

crates/solscript-ast/src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ pub struct FnDef {
252252
pub state_mutability: Vec<StateMutability>,
253253
pub modifiers: Vec<ModifierInvocation>,
254254
pub return_params: Vec<ReturnParam>,
255-
pub body: Option<Block>, // None for abstract functions
255+
pub body: Option<Block>, // None for abstract functions
256256
pub span: Span,
257257
}
258258

@@ -340,7 +340,7 @@ pub enum Stmt {
340340
Revert(RevertStmt),
341341
Delete(DeleteStmt),
342342
Selfdestruct(SelfdestructStmt),
343-
Placeholder(Span), // _ in modifiers
343+
Placeholder(Span), // _ in modifiers
344344
Expr(ExprStmt),
345345
}
346346

@@ -504,7 +504,7 @@ pub enum BinaryOp {
504504
Mul,
505505
Div,
506506
Rem,
507-
Exp, // **
507+
Exp, // **
508508
// Comparison
509509
Eq,
510510
Ne,
@@ -532,13 +532,13 @@ pub struct UnaryExpr {
532532

533533
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
534534
pub enum UnaryOp {
535-
Not, // !
536-
Neg, // -
537-
BitNot, // ~
538-
PreInc, // ++x
539-
PreDec, // --x
540-
PostInc, // x++
541-
PostDec, // x--
535+
Not, // !
536+
Neg, // -
537+
BitNot, // ~
538+
PreInc, // ++x
539+
PreDec, // --x
540+
PostInc, // x++
541+
PostDec, // x--
542542
}
543543

544544
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]

crates/solscript-ast/src/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl TypePath {
7575
}
7676

7777
/// Get the full path as a string
78-
pub fn to_string(&self) -> String {
78+
pub fn full_path(&self) -> String {
7979
self.segments
8080
.iter()
8181
.map(|s| s.name.as_str())
@@ -106,7 +106,7 @@ pub struct MappingType {
106106
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
107107
pub struct ArrayType {
108108
pub element: TypePath,
109-
pub sizes: Vec<Option<u64>>, // None = dynamic [], Some(n) = fixed [n]
109+
pub sizes: Vec<Option<u64>>, // None = dynamic [], Some(n) = fixed [n]
110110
pub span: Span,
111111
}
112112

@@ -227,7 +227,7 @@ pub enum PrimitiveType {
227227

228228
impl PrimitiveType {
229229
/// Try to parse a primitive type from a string
230-
pub fn from_str(s: &str) -> Option<Self> {
230+
pub fn parse(s: &str) -> Option<Self> {
231231
match s {
232232
// uint aliases
233233
"uint" | "uint256" => Some(Self::Uint256),

0 commit comments

Comments
 (0)