Skip to content

Commit

Permalink
chore(docs): address visibility issues in docs (#3643)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

Resolves #3452

## Summary\*

This PR makes two changes in the docs:
1. I've removed the visibility modifier on an argument to the
non-entrypoint function `foo`. This code would compile but would also
raise a warning on `pub` being unnecessary and misleading so we should
just remove it.
2. `pub` was missing on a `main` function return value in
`7_mutability.md`.


## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [x] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
TomAFrench authored Nov 30, 2023
1 parent c43c4a2 commit 6e3aea5
Show file tree
Hide file tree
Showing 22 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions docs/docs/language_concepts/01_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/language_concepts/07_mutability.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ All parameters in a function must have a type and all types are known at compile
is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma.

```rust
fn foo(x : Field, y : pub Field){}
fn foo(x : Field, y : Field){}
```

The return type of a function can be stated by using the `->` arrow notation. The function below
states that the foo function must return a `Field`. If the function returns no value, then the arrow
is omitted.

```rust
fn foo(x : Field, y : pub Field) -> Field {
fn foo(x : Field, y : Field) -> Field {
x + y
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note that mutability in noir is local and everything is passed by value, so if a
mutates its parameters then the parent function will keep the old value of the parameters.

```rust
fn main() -> Field {
fn main() -> pub Field {
let x = 3;
helper(x);
x // x is still 3
Expand Down

0 comments on commit 6e3aea5

Please sign in to comment.