@@ -7,8 +7,8 @@ use reqwest::StatusCode;
77use toml_edit:: { Array , Item , Table } ;
88use tracing:: { debug, warn} ;
99use typst:: syntax:: {
10- package:: { PackageSpec , PackageVersion } ,
1110 FileId , VirtualPath ,
11+ package:: { PackageSpec , PackageVersion } ,
1212} ;
1313use walkdir:: WalkDir ;
1414
@@ -178,20 +178,20 @@ fn check_name(
178178 ) ;
179179 }
180180
181- if let Some ( package_spec) = package_spec {
182- if name. val != package_spec. name {
183- diags. emit (
184- error
185- . with_code ( "manifest/package/name/mismatch" )
186- . with_message ( format ! (
187- "Unexpected package name. `{name}` was expected. \
181+ if let Some ( package_spec) = package_spec
182+ && name. val != package_spec. name
183+ {
184+ diags. emit (
185+ error
186+ . with_code ( "manifest/package/name/mismatch" )
187+ . with_message ( format ! (
188+ "Unexpected package name. `{name}` was expected. \
188189 If you want to publish a new package, create a new \
189190 directory in `packages/{namespace}/`.",
190- name = package_spec. name,
191- namespace = package_spec. namespace,
192- ) ) ,
193- )
194- }
191+ name = package_spec. name,
192+ namespace = package_spec. namespace,
193+ ) ) ,
194+ )
195195 }
196196
197197 Some ( name. to_owned ( ) )
@@ -239,21 +239,21 @@ fn check_version(
239239 return None ;
240240 } ;
241241
242- if let Some ( package_spec) = package_spec {
243- if version. val != package_spec. version {
244- diags. emit (
245- error
246- . with_code ( "manifest/package/version/mismatch" )
247- . with_message ( format ! (
248- "Unexpected version number. `{version}` was expected. \
242+ if let Some ( package_spec) = package_spec
243+ && version. val != package_spec. version
244+ {
245+ diags. emit (
246+ error
247+ . with_code ( "manifest/package/version/mismatch" )
248+ . with_message ( format ! (
249+ "Unexpected version number. `{version}` was expected. \
249250 If you want to publish a new version, create a new \
250251 directory in `packages/{namespace}/{name}`.",
251- version = package_spec. version,
252- name = package_spec. name,
253- namespace = package_spec. namespace,
254- ) ) ,
255- )
256- }
252+ version = package_spec. version,
253+ name = package_spec. name,
254+ namespace = package_spec. namespace,
255+ ) ) ,
256+ )
257257 }
258258
259259 Some ( version)
@@ -684,20 +684,20 @@ fn check_thumbnail(diags: &mut Diagnostics, exclude: &Override, template: &Spann
684684 ) ;
685685 }
686686
687- if let Some ( template_path) = & template. path {
688- if thumbnail_path. full ( ) . starts_with ( template_path. full ( ) ) {
689- diags. emit (
690- Diagnostic :: error ( )
691- . with_label ( Label :: primary ( manifest_id ( ) , thumbnail_path. span ( ) ) )
692- . with_code ( "manifest/template/thumbnail/location" )
693- . with_message (
694- "The thumbnail file should be outside of the template directory.\n \n \
687+ if let Some ( template_path) = & template. path
688+ && thumbnail_path. full ( ) . starts_with ( template_path. full ( ) )
689+ {
690+ diags. emit (
691+ Diagnostic :: error ( )
692+ . with_label ( Label :: primary ( manifest_id ( ) , thumbnail_path. span ( ) ) )
693+ . with_code ( "manifest/template/thumbnail/location" )
694+ . with_message (
695+ "The thumbnail file should be outside of the template directory.\n \n \
695696 When your template will be used as a base for users's projects, \
696697 the template directory will be copied as is, and the thumbnail file
697698 is generally not displayed in documents based on your template." ,
698- ) ,
699- ) ;
700- }
699+ ) ,
700+ ) ;
701701 }
702702}
703703
0 commit comments