A few minor lints and docs (#1436)

* A few minor lints and docs

* Added required packages to compile on Debian-style linux
* Inlined some format args, and removed some `&` in args (they cause about 6% slowdown that compiler cannot inline)
* a few spelling mistakes

* fix fmt
This commit is contained in:
Yuri Astrakhan
2023-10-19 02:33:10 -04:00
committed by GitHub
parent 67edac4aca
commit 3d4e3a74e5
51 changed files with 140 additions and 158 deletions

View File

@@ -16,6 +16,11 @@ Clone the project:
git clone https://github.com/GraphiteEditor/Graphite.git
```
On Debian-based Linux distributions, you may need to install the following packages:
```sh
sudo apt install libgtk-3-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev libwebkit2gtk-4.0-dev
```
Then install the required Node.js packages:
```sh
cd frontend

View File

@@ -48,7 +48,7 @@ fn parse_t_variant(t_variant: &String, t: f64) -> TValue {
match t_variant.as_str() {
"Parametric" => TValue::Parametric(t),
"Euclidean" => TValue::Euclidean(t),
_ => panic!("Unexpected TValue string: '{}'", t_variant),
_ => panic!("Unexpected TValue string: '{t_variant}'"),
}
}
@@ -162,7 +162,7 @@ impl WasmBezier {
let tvalue_type = match t_variant.as_str() {
"Parametric" => TValueType::Parametric,
"Euclidean" => TValueType::Euclidean,
_ => panic!("Unexpected TValue string: '{}'", t_variant),
_ => panic!("Unexpected TValue string: '{t_variant}'"),
};
let table_values: Vec<DVec2> = self.0.compute_lookup_table(Some(steps), Some(tvalue_type));
let circles: String = table_values

View File

@@ -26,7 +26,7 @@ fn parse_t_variant(t_variant: &String, t: f64) -> SubpathTValue {
match t_variant.as_str() {
"GlobalParametric" => SubpathTValue::GlobalParametric(t),
"GlobalEuclidean" => SubpathTValue::GlobalEuclidean(t),
_ => panic!("Unexpected TValue string: '{}'", t_variant),
_ => panic!("Unexpected TValue string: '{t_variant}'"),
}
}
@@ -104,7 +104,7 @@ impl WasmSubpath {
let tvalue_type = match t_variant.as_str() {
"GlobalParametric" => TValueType::Parametric,
"GlobalEuclidean" => TValueType::Euclidean,
_ => panic!("Unexpected TValue string: '{}'", t_variant),
_ => panic!("Unexpected TValue string: '{t_variant}'"),
};
let table_values: Vec<DVec2> = self.0.compute_lookup_table(Some(steps), Some(tvalue_type));
let circles: String = table_values
@@ -385,7 +385,7 @@ impl WasmSubpath {
main_subpath.iter().enumerate().for_each(|(index, bezier)| {
let hue1 = &format!("hsla({}, 100%, 50%, 0.5)", 40 * index);
let hue2 = &format!("hsla({}, 100%, 50%, 0.5)", 40 * (index + 1));
let gradient_id = &format!("gradient{}", index);
let gradient_id = &format!("gradient{index}");
let start = bezier.start();
let end = bezier.end();
let _ = write!(
@@ -400,7 +400,7 @@ impl WasmSubpath {
hue2
);
let stroke = &format!("url(#{})", gradient_id);
let stroke = &format!("url(#{gradient_id})");
bezier.curve_to_svg(
&mut main_subpath_svg,
CURVE_ATTRIBUTES.to_string().replace(BLACK, stroke).replace("stroke-width=\"2\"", "stroke-width=\"8\""),

View File

@@ -25,7 +25,7 @@ pub const TEXT_OFFSET_X: f64 = 5.;
pub const TEXT_OFFSET_Y: f64 = 193.;
pub fn wrap_svg_tag(contents: String) -> String {
format!("{}{}{}", SVG_OPEN_TAG, contents, SVG_CLOSE_TAG)
format!("{SVG_OPEN_TAG}{contents}{SVG_CLOSE_TAG}")
}
/// Helper function to create an SVG text entity.

View File

@@ -5,7 +5,7 @@ pub fn parse_join(join: i32, miter_limit: f64) -> Join {
0 => Join::Bevel,
1 => Join::Miter(Some(miter_limit)),
2 => Join::Round,
_ => panic!("Unexpected Join value: '{}'", join),
_ => panic!("Unexpected Join value: '{join}'"),
}
}
@@ -14,6 +14,6 @@ pub fn parse_cap(cap: i32) -> Cap {
0 => Cap::Butt,
1 => Cap::Round,
2 => Cap::Square,
_ => panic!("Unexpected Cap value: '{}'", cap),
_ => panic!("Unexpected Cap value: '{cap}'"),
}
}