• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TyRoXx / NonlocalityOS / 15374094570

01 Jun 2025 10:43AM UTC coverage: 73.176% (+0.3%) from 72.922%
15374094570

Pull #276

github

web-flow
Merge 5d95322e6 into 78385419b
Pull Request #276: GH-275: begin code formatting algorithm

66 of 71 new or added lines in 2 files covered. (92.96%)

2 existing lines in 1 file now uncovered.

3530 of 4824 relevant lines covered (73.18%)

2150.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.48
/lambda_compiler/src/format.rs
1
use crate::ast::Expression;
2

3
fn format_string_literal<W>(content: &str, writer: &mut W) -> std::fmt::Result
6✔
4
where
5
    W: std::fmt::Write,
6
{
7
    write!(writer, "\"")?;
6✔
8
    for character in content.chars() {
29✔
9
        match character {
23✔
10
            '"' | '\'' | '\\' => write!(writer, "\\{}", character)?,
3✔
11
            '\n' => write!(writer, "\\n")?,
1✔
12
            '\r' => write!(writer, "\\r")?,
1✔
13
            '\t' => write!(writer, "\\t")?,
1✔
14
            _ => write!(writer, "{}", character)?,
17✔
15
        }
16
    }
17
    write!(writer, "\"")
6✔
18
}
19

20
fn format_apply<W>(
3✔
21
    callee: &Expression,
22
    arguments: &[Expression],
23
    writer: &mut W,
24
) -> std::fmt::Result
25
where
26
    W: std::fmt::Write,
27
{
28
    format_expression(callee, writer)?;
3✔
29
    write!(writer, "(")?;
3✔
30
    for argument in arguments.iter() {
6✔
31
        format_expression(argument, writer)?;
3✔
32
        write!(writer, ", ")?;
3✔
33
    }
34
    write!(writer, ")")
3✔
35
}
36

37
pub fn format_expression<W>(expression: &Expression, writer: &mut W) -> std::fmt::Result
13✔
38
where
39
    W: std::fmt::Write,
40
{
41
    match expression {
13✔
42
        Expression::Identifier(name, _source_location) => write!(writer, "{}", &name.key),
4✔
43
        Expression::StringLiteral(content) => format_string_literal(content, writer),
6✔
44
        Expression::Apply { callee, arguments } => format_apply(callee, arguments, writer),
3✔
45
        Expression::Lambda { parameters, body } => todo!(),
46
        Expression::ConstructTree(expressions) => todo!(),
47
        Expression::Braces(expression) => todo!(),
NEW
48
        Expression::Let {
×
NEW
49
            name,
×
NEW
50
            location,
×
NEW
51
            value,
×
NEW
52
            body,
×
53
        } => todo!(),
54
    }
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc