chore: fix clippy warnings, remove license template

The license template has been removed from rustfmt nightly :(
This commit is contained in:
Lucas Nogueira 2022-06-24 22:01:13 -03:00
parent 9d33d09341
commit 23a049c593
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1
33 changed files with 23 additions and 84 deletions

View File

@ -33,7 +33,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt

View File

@ -34,7 +34,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt

View File

@ -92,7 +92,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -100,6 +100,8 @@ use std::{
};
pub type WebviewId = u64;
type IpcHandler = dyn Fn(&Window, String) + 'static;
type FileDropHandler = dyn Fn(&Window, WryFileDropEvent) -> bool + 'static;
mod webview;
pub use webview::Webview;
@ -3067,7 +3069,7 @@ fn create_ipc_handler<T: UserEvent>(
menu_ids: Arc<Mutex<HashMap<MenuHash, MenuId>>>,
js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u64>>>>,
handler: WebviewIpcHandler<T, Wry<T>>,
) -> Box<dyn Fn(&Window, String) + 'static> {
) -> Box<IpcHandler> {
Box::new(move |window, request| {
let window_id = context.webview_id_map.get(&window.id());
handler(
@ -3086,9 +3088,7 @@ fn create_ipc_handler<T: UserEvent>(
}
/// Create a wry file drop handler.
fn create_file_drop_handler<T: UserEvent>(
context: &Context<T>,
) -> Box<dyn Fn(&Window, WryFileDropEvent) -> bool + 'static> {
fn create_file_drop_handler<T: UserEvent>(context: &Context<T>) -> Box<FileDropHandler> {
let window_event_listeners = context.window_event_listeners.clone();
let webview_id_map = context.webview_id_map.clone();
Box::new(move |window, event| {

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -25,7 +25,6 @@ use tauri_utils::{
html::{SCRIPT_NONCE_TOKEN, STYLE_NONCE_TOKEN},
};
use crate::app::{GlobalMenuEventListener, WindowMenuEvent};
use crate::hooks::IpcJavascript;
#[cfg(feature = "isolation")]
use crate::hooks::IsolationJavascript;
@ -51,6 +50,10 @@ use crate::{
Context, EventLoopMessage, Icon, Invoke, Manager, Pattern, Runtime, Scopes, StateManager, Window,
WindowEvent,
};
use crate::{
app::{GlobalMenuEventListener, WindowMenuEvent},
window::WebResourceRequestHandler,
};
#[cfg(any(target_os = "linux", target_os = "windows"))]
use crate::api::path::{resolve_path, BaseDirectory};
@ -390,9 +393,7 @@ impl<R: Runtime> WindowManager<R> {
label: &str,
window_labels: &[String],
app_handle: AppHandle<R>,
web_resource_request_handler: Option<
Box<dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync>,
>,
web_resource_request_handler: Option<Box<WebResourceRequestHandler>>,
) -> crate::Result<PendingWindow<EventLoopMessage, R>> {
let is_init_global = self.inner.config.build.with_global_tauri;
let plugin_init = self
@ -1045,9 +1046,7 @@ impl<R: Runtime> WindowManager<R> {
app_handle: AppHandle<R>,
mut pending: PendingWindow<EventLoopMessage, R>,
window_labels: &[String],
web_resource_request_handler: Option<
Box<dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync>,
>,
web_resource_request_handler: Option<Box<WebResourceRequestHandler>>,
) -> crate::Result<PendingWindow<EventLoopMessage, R>> {
if self.windows_lock().contains_key(&pending.label) {
return Err(crate::Error::WindowLabelAlreadyExists(pending.label));

View File

@ -46,6 +46,8 @@ use std::{
process::{exit, Command},
};
type ShouldInstall = dyn FnOnce(&Version, &RemoteRelease) -> bool + Send;
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum RemoteReleaseInner {
@ -209,7 +211,7 @@ pub struct UpdateBuilder<R: Runtime> {
pub target: Option<String>,
/// The current executable path. Default is automatically extracted.
pub executable_path: Option<PathBuf>,
should_install: Option<Box<dyn FnOnce(&Version, &RemoteRelease) -> bool + Send>>,
should_install: Option<Box<ShouldInstall>>,
timeout: Option<Duration>,
headers: HeaderMap,
}

View File

@ -45,6 +45,8 @@ use std::{
sync::Arc,
};
pub(crate) type WebResourceRequestHandler = dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync;
#[derive(Clone, Serialize)]
struct WindowCreatedEvent {
label: String,
@ -103,7 +105,7 @@ pub struct WindowBuilder<'a, R: Runtime> {
label: String,
pub(crate) window_builder: <R::Dispatcher as Dispatch<EventLoopMessage>>::WindowBuilder,
pub(crate) webview_attributes: WebviewAttributes,
web_resource_request_handler: Option<Box<dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync>>,
web_resource_request_handler: Option<Box<WebResourceRequestHandler>>,
}
impl<'a, R: Runtime> fmt::Debug for WindowBuilder<'a, R> {

View File

@ -1 +0,0 @@
../../../../.license_template

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -14,4 +14,3 @@ force_explicit_abi = true
# normalize_comments = true
normalize_doc_attributes = true
# wrap_comments = true
license_template_path = ".license_template"

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -18,11 +18,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install rustfmt with nightly toolchain
- name: Install rustfmt with stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1

View File

@ -1 +0,0 @@
{{ license_template }}

View File

@ -18,11 +18,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install rustfmt with nightly toolchain
- name: Install rustfmt with stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1

View File

@ -1 +0,0 @@
{{ license_template }}

View File

@ -1,3 +0,0 @@
// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT